I am polling the state of the the pins attached to the i/o expander, but for some reason, pin.getState() returns null. Once the state of the pin is changed by rotating the switch, the getState() stops returning null and reports as high or low. (Though even then, it seems flakey)
I think I'm missing an initialization step or perhaps I just don't understand how this is supposed to work.
result is "null"
Code: Select all
final GpioController gpio = GpioFactory.getInstance(); final MCP23017GpioProvider gpioProvider3 = new MCP23017GpioProvider(I2CBus.BUS_1, 0x21); GpioPinDigitalInput pin = gpio.provisionDigitalInputPin(gpioProvider, MCP23017Pin.GPIO_A0, "3.A0", PinPullResistance.PULL_UP); System.out.println(pin.getState());
Any help would be greatly appreciated.
Thanks in advance,