|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
| Thread Tools | Rate Thread | Display Modes |
|
#1
|
||||
|
||||
|
Arduino + CRIO
How can I get an arduino and a crio to communicate with each other. My goal is for the arduino to send information to the crio in some way and the crio will use the data values sent and perform tasks with the robot that correspond with the data sent. Is this able to be done through network tables or how could it be done? Thanks!
|
|
#2
|
|||
|
|||
|
Re: Arduino + CRIO
The Arduino can be an I2C slave. Use serial or the lan UDP. Lan solution needs a lan board.
|
|
#3
|
|||||
|
|||||
|
Re: Arduino + CRIO
I've personally never tried it. However, I know that it is possible. People use Arduino devices to control LED circuits controlled by the cRIO all the time.
Depending on what kind of information you want to send back to the cRIO I could potentially help you further. I do use Arduino a lot in my University lab classes so I'm familiar with almost all aspects of it. I2C is the first thing that would come to mind in terms of communication, and I think the LAN board solution...might work. I'll be testing both once I get the RoboRIO for future knowledge on that front as well. |
|
#4
|
|||
|
|||
|
Re: Arduino + CRIO
Quote:
Pretty please with LEDs on top? |
|
#5
|
|||
|
|||
|
Re: Arduino + CRIO
When we did LEDs in 2013 we just used a few DIO pins to send different combinations to IO pins on the arduino to run different light routines.
|
|
#6
|
|||
|
|||
|
Re: Arduino + CRIO
https://github.com/FRC-Team-4143/swerveneopixel
This sketch controls Adafruit neopixel leds over i2c. I2c is echoed over serial for debugging. Crio code (in c++) is something like: Code:
m_i2c = DigitalModule::GetInstance(1)->GetI2C(0x04 << 1); RobotMap::m_i2c->Write(0x0, 50); The i2c address is 0x4, but you have to shift it left on the Crio to write. That is the tricky part. Last edited by RyanShoff : 05-08-2014 at 14:11. Reason: changed parameter to not get confused with address |
|
#7
|
|||
|
|||
|
Re: Arduino + CRIO
Added some detail about addressing for anyone curious why what Ryan posted is true.
|
|
#8
|
||||
|
||||
|
Re: Arduino + CRIO
Would love to hear from anyone who has set up an Arduino as an I2C slave and sent info back and forth with the cRIO.
We simply used a few DIO to toggle between preset LED patterns. |
|
#9
|
||||
|
||||
|
Re: Arduino + CRIO
Quote:
1. As people have already mentioned Arduino's i2c addressing hides the bottom bit, so you'll have slightly different addresses on the Arduino and CRIO 2. The round cable connecting the cRIO to the digital BO does not include the i2c connection, you'll need to use a ribbon cable. |
|
#10
|
||||
|
||||
|
Re: Arduino + CRIO
Look at the LED.Java and Shooter_Lights.ino in are code from this year. We used it to control the lights on are arm.
Last edited by orangelight : 08-08-2014 at 09:46. |
|
#11
|
|||
|
|||
|
Re: Arduino + CRIO
Quote:
Mr. Lim, This thread may help. Mike |
|
#12
|
||||
|
||||
|
Re: Arduino + CRIO
We've used a serial connection between the arduino and the cRIO for the past two years. It's much simpler to set up and debug than I2C.
You will need a level converter between the cRIO, which is RS-232(can be a wide range of voltages, IIRC the 8 slot cRIO was +10, -5), and the arduino which is TTL (normal 5V logic). I used this (http://www.ebay.com/itm/MAX232-RS232...-/221022603873) level converter board to plug directly into the cRIO. The level converter was powered with the 5V supply on the arduino, and works very well. If you're interested, I can probably dig up the code for this. |
|
#13
|
|||
|
|||
|
Re: Arduino + CRIO
Jared - Interested in code and general wiring diagram, thanks.
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|