Code: Select all
Sub PulseOut (PinNumber as Integer, Length as Integer) 'Length in mS
IO(PinNumber) = NOT(IO(PinNumber)) 'this reversal works
WAIT(Length)
IO(PinNumber) = NOT(IO(PinNumber)) 'this one does not.
End Sub
IO is more complex than just setting a pin.
IO (as the Help files state) sets the direction of the pin then sets the drive level.
so IO(x) = NOT(IO(x))
is converting a pin to an input reading it and then converting to an output and driving it
But during the conversion to an input you are no longer driving it. So you really want to do--
OUT(x) = NOT(IN(x))
As OUT just changes the drive level, and IN reads the pin value whether or not it is being driven (also in the Help files)