I’m pretty new to arduino’s and programming, but i’m a fast learner. I’m pretty proud of what I have achieved so far just by trying and making mistakes.
Right now I have written a code for sending input/output information to 3x MCP23017 which is pretty straigth forward. I’m using the <Adafruit_MCP23017.h> for this.
The GPA ports are inputs with momentary pushbuttons and the GPB’s are outputs toggled by the momentary buttons to drive relays (push once is on, push again off). I need those 3 expanders because I need 24 ins and 24 outs to drive the relays (with a transistor array since the coils are 24v).
So far so good and it’s working as expected. 8)
Now I want to write and read the last states of the GPB outputs (and maybe some memories) so that it comes back to the last state after power down. So I guess I need to write and read the i2c state for that, but i’m lost on what code to use and where to put it.
The only really a bit usefull information is in this topic, but it’s 5 years old: https://forum.arduino.cc/index.php?topic=291470.0
Could someone please help me with this?
I’m also wondering if the onboard EEPROM (uno) will be enough for this or maybe it’s a good idea to use an external EEPROM using i2c.
code.txt (24.2 KB)