Hi All,
Has anyone had any success in getting the Interrupt functions working on the MCP23017 port extender chip?
I am trying to use the interrupt functions on a MCP23017 with 12 push buttons as inputs, attached to a WEMOS D1 R2 controller.
I would like one of the MCP23017 interrupt pins (INTA, INTB) to change when one of the push buttons are pressed.
I have tried Erel's examples in https://www.b4x.com/android/forum/posts/461711/.
At this stage I have the device address set to 0x20, the IO set to Inputs using IODIRA & B set to 0xFF which set all IO's to Inputs and GPPUA & B to use the internal pull-up resistors for each Input.
From research I have found that once an Input changes state the interrupt flag INFTFA & B needs to be read to indicate which input was triggered.
In Erel's example.
I assume that master.Write sets the device (0x20) and the address (0x12) to read from while the master.RequestFrom then reads the data back.
I have setup Interrupt pins with listeners but not able to get to work.
Does anyone have any ideas?
Thanks
Has anyone had any success in getting the Interrupt functions working on the MCP23017 port extender chip?
I am trying to use the interrupt functions on a MCP23017 with 12 push buttons as inputs, attached to a WEMOS D1 R2 controller.
I would like one of the MCP23017 interrupt pins (INTA, INTB) to change when one of the push buttons are pressed.
I have tried Erel's examples in https://www.b4x.com/android/forum/posts/461711/.
At this stage I have the device address set to 0x20, the IO set to Inputs using IODIRA & B set to 0xFF which set all IO's to Inputs and GPPUA & B to use the internal pull-up resistors for each Input.
From research I have found that once an Input changes state the interrupt flag INFTFA & B needs to be read to indicate which input was triggered.
In Erel's example.
B4X:
master.WriteTo(0x20, Array As Byte(0x12 + PortIndex)) 'will be either 0x12 or 0x13
Dim result() As Byte = master.RequestFrom(0x20, 1)
I have setup Interrupt pins with listeners but not able to get to work.
Does anyone have any ideas?
Thanks