Hello all! I’m doing a project with the Rainbowduino. I need to add several inputs from a radio control receiver to my project, but the Rainbowduino has none (all I/O pins are used for driving the display). The Rainbowduino IS, however, capable of I2C communication as I understand it.
(more info - seeedstudio.com/wiki/Rainbowduino_v3.0)
I recognize I can use shift registers and other pieces of equipment specifically tailored to this task, but all I have are extra Arduinos (5 of them, actually!). I found this video and tutorial documenting its ability to act as an I/O pin expander, as well as a sample code to do it with: rodelectronics.blogspot.com/2010 … duino.html
I believe this allows me to call the inputs as a pin from the slave arduino (inputs connected to the master), but as a novice in C++ I’m not entirely sure how to interact with the code to get it to do what I want. I tried altering the code to get a successful testing of the ability to do this between two plain-jane Arduinos, but to no avail. Right now the serial monitor is just printing “0” over and over again, rather than the radio input’s value range of 1000-2000. Code posted on Pastebin below:
Master - pastebin.com/7JBh5KzD
Slave - pastebin.com/7gp4wvRD
My hardware setup right now:
-Radio input is connected to digital pin 7 on Master.
-Master and slave are both Arduinos (I want to make sure this works at the basic level before introducing the Rainbowduino hardware).
-My goal is to have the radio input connected to the master, and read the output through the serial monitor of the slave to make sure everything is being received correctly.
Here is working code that reads the radio inputs and sends it to the serial monitor on one Arduino. I named each radio input “rx(n)” - pastebin.com/jrJedzsM
-If I’m basically mapping the input from one Arduino to another whose inputs are filled, should I/can I map the replicated input to a new, non-existent input pin on the new Arduino (meaning, Arduinos have pins 1-13. Can I call the replicated pin “pin 14”)
-This code seems to make a read of the I2C circuit whenever data is sent to it. Does this effectively mean that it can read the input value while loop is running? The project needs to be able to react to the inputs in real-time, interrupting a loop if a radio input value dictates a new command.