mcauser / micropython-pcf8574

MicroPython driver for PCF8574 8-Bit I2C I/O Expander with Interrupt
MIT License
37 stars 6 forks source link

Question: how to use interrupt? #1

Closed rdehuyss closed 3 years ago

rdehuyss commented 3 years ago

Hi,

First of all, thanks for this great library!

I do have a question - I don't understand how to use the interrupts. Could you please provide an example?

I would expect a callback to be called with the pin that changed and it's new value.

Thanks in advance, Ronald

rdehuyss commented 3 years ago

Never mind - I thought I could be notified via the I2C bus. If I understand correctly, I need to use another gpio pin that is connected to the interupt pin of the pcf-8574.

mcauser commented 3 years ago

Yes, that is correct. It doesn't notify over I2C. Just uses that extra INT pin, broken out on some boards, which you can listen for changes on.

The INT pin requires a pull-up resistor and when the chip detects a change, will drive the pin low.

rdehuyss commented 3 years ago

Thx!