I have been wanting to get an MCP23008 I2C port expander connected to my Raspberry Pi for quite a while. I finally got one and during my breaks from LabVIEW CLD exam preparation, made the circuit on some strip board.
Using the Quick2Wire Python I2C library makes getting this working really quick and easy. Just make sure you place your LED's the correct way around. I spent a bit of time debugging the I2C until I thought of checking the obvious.
Currently I only have the outputs working as I didn't have any switches with me. I'll add two switches and get that going next.
Here is the code that I used. I set up a little menu to select which LED to turn on or off.
Next I plan to get the software PWM working so that I can connect up to Cheerlights. Need to do some more studying and then will get that going. Also need some RGB LED's first.
Until next time, happy coding.
Greg
No comments:
Post a Comment