How can i read pin state which is set to output mode?
// Variable to represent LED state
local ledState = 0;
// Variable to represent LED inhibit state
local inhibit = 0;
// input class for LED control channel
class input extends InputPort
{
name = "control"
type = “number”
function set(value)
{
server.log(value);
if(value == 1)
{
hardware.pin9.write(1);
}
else if(value == 0)
{
hardware.pin9.write(0);
}
server.log(hardware.pin9.read()?"On":"Off");
}
}
// Configure pin 9 as an open drain output with internal pull up
hardware.pin9.configure(DIGITAL_OUT);
// Register with the server
imp.configure(“Blinki”, [input()], []);
// Start blinking
//blink();
// End of code.