Pin State Read

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.

This is a bug in Releases 1-7, sorry. All GPIO output types (DIGITAL_OUT, DIGITAL_OUT_OD, DIGITAL_OUT_OD_PULLUP) currently read as zero, whereas in fact the hardware is perfectly capable of reporting the actual state. I’ll try and get a fix into the next release.

Peter