Python Forum
i2c on Raspberry Pi 4 - MCP23017 - Arduino Mega
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
i2c on Raspberry Pi 4 - MCP23017 - Arduino Mega
#1
Greetings,

I am having the hardest time trying to find a good sample code to start expanding my GPIOs on my Raspberry Pi 4. The problem is I am not making letters or symbols, I am trying to independently turn on/off individual outputs with different hooks. I have searched for 3 weeks now, and I haven't found anything that I can expound on. I have tried many libraries, but the code always says something or another isn't defined. I have updated just about everything and I don't know what to look for anymore. I don't have any code to post because I haven't gotten anything to work.

Can I ask for some help?

I can go either way, either MCP23017, or Arduino Mega. Can someone share a sample code that will show me some sign of life? Lets start simple. Can I see, say 8 LEDs (Outputs) cascading in a loop so I can see how to target the GPOs? If it's Arduino, obviously that gives me over 50 outputs, so it would just be a matter of targeting the right pin. If its the MCP23017, then how do you address outputs on multiple boards? I know about addressing, but I am not sure how to direct the code to talk to the right target. It seems that I missed the boat. Most things that are written for this is 10 years old. I should also say, I don't want to use the USB to talk to Arduino. I'd like to stay on i2c.

This is just to get the conversation started, so if I am vague about something, then I can answer some more questions, but I'm not sure what is relevant at this point. Also, I'm not good at running programs from a terminal, so I use Thonny to write and run things.
Reply
#2
Why aren't you posting to a Raspberry Pi forum?

https://forums.raspberrypi.com/viewforum.php?f=32

I'm not asking you to go away, but I'd think you would get a better response there since this is really a hardware question and not so much a Python question.
Reply
#3
Because I use Python to program Raspberry Pi. Like I said, I'm looking for the best approach.
Reply
#4
Have you seen this tutorial?
complete GPIO coverage, and also includes I2C
https://electropeak.com/learn/tutorial-r...ull-guide/
Reply


Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020