Need Help Getting RoboRIO to Send Data to Arduino

We are trying to use an I2C cable to connect the Arduino UNO to the RoboRIO and have it send and receive data, so we can switch LED colors on our LED Strip which is connected to our Arduino (It uses the 5 Pin, Ground, and 5V ports if it helps). I don’t know where to start, for example, where should I put the I2C cable into the Arduino? Should I put it into the ICSP even though its only 2x3 so 6 pins? Will, we using C++ on the Arduino and Java for our Robot Code affect anything? Also, we are using a 3 pin LED Strip. Our ultimate goal is to be able to click a button on our Shuffleboard to changed LED colors. I haven’t used C++ before the LED and had some Java experience, so I’m not sure what the code is for receiving data over I2C. We are using FastLED for our Arduino, our code is posted below:

https://pastebin.com/6JfKZPJD

I would attach the Arduino using the I2C ports that are baked in. SDA/SCL are pins A4/A5 on the Uno. Any ground pin should also be connected - there are two close by to SDA/SCL to choose from.

Your arduino should be the “slave” device in this case, since it’s receiving a signal and performing an action based on it. The arduino Wire library is great for this.

This is a good article from Arduino about this. Your arduino code will look something like the slave_receiver file from this example. The wire.begin() method lets you pick an I2C address to use.

As for the roboRIO, you’ll need to use the I2C library to send a signal to your arduino on whatever address you set in the arduino code.

Hope this is a helpful start!

1 Like

Alright, thanks! I’ll use the information provided.

Depending on the data, could you also potentially use dio between the Rio and Arduino?

Dio?

Digital Input and output. You could have the Rio one go high when an event happens, and then on the Arduino listen for it. The Rio has 10. You want to make sure the voltage can be read by the Arduino (the rio outputs 3.3v from the DIO).

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.