I am an electrical engineering student, so people think I should know this. I have not found a correct answer. Is there any reference material or any suggestions that may help me understand this? Programming is like Chinese, but I mutter through it.
I would like to communicate with the I2C bus and not have to poll for every response from a device on the bus. I would like to leave the line open and when a device gets new information I would like it to respond then instead of waiting for me to poll for the information.
I2C bus is usually one master and multiple slaves. The slaves cannot talk on the bus unless the master asks them to talk. This is also known as polling. The bus can also handle multiple masters.
Some devices have an interrupt output separate from the I2C bus.
What device do you have? Is it a master? Does it have an interrupt output or some sort of ready output?
If your device cannot be an I2C master to start a message sequence, then you either have to poll it or connect to an interrupt pin if the device has one. When you get an interrupt, that's when you request data from it.
Yes to the schematic, and yes I do now. What can I do with that? I see that it says int (interrupt). Is this for doing what I ask? I ask in risk of sounding dumb, haha. Will this Gammon website tel me?
I admit that I prefer actions triggered by events so I tend to lean away from polling, but if you are not using the I2C bus for anything else and the Arduino is not doing much else, polling may be the way to go.
Interrupts will lead you into an area that makes debugging a challenge and is difficult for some.
I am using the rest of my analog pins along with a couple other devices on the I2C bus. This is a large project and I was unclear if interrupts were even an option.
I have to dig into this further, but thank you for the warning =D
The SX1509 on the board has two address lines, you can use those as board select lines.
Connect A1 high, and connect each A0 to an Arduino output that is normally high.
When you want to talk to one, drive that device's A0 Low and use I2C address 0x70.
If you connect each INT line to separate Arduino pins also, then you can write an interrupt routine to read from the device that pulled its interrupt pin low.
You can play with the Library code also under the Documents tab, see what it can do.