Go to Post This is about more than building a robot, we cannot only do the fun things. If you are fully involved than you will be prepared to do anything in life. - Andy Brockway [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #11   Spotlight this post!  
Unread 22-02-2014, 20:04
rben13 rben13 is offline
Registered User
FRC #1153 (Walpole Rebels)
Team Role: Coach
 
Join Date: Feb 2014
Rookie Year: 2013
Location: United States
Posts: 4
rben13 is an unknown quantity at this point
Re: Connecting a Arduino to a cRio to control LEDs

I finally discovered how to get the cRIO to talk to the Arduino. Well, actually, I found someone who knew who sent me some example code that was very helpful.

The key is to use the Serial library that's in the WPI Library, not the one in the instrument library. Once you know that, it's pretty easy to figure out the rest. Set your serial port up to whatever baud rate you plan to use, configure to 8-bits, no parity, 1 stop bit. We have very short messages so had no need for flow control. To send messages from the cRIO to the Arduino, I'm sending single characters followed by a newline and then flushing the buffer.

If you're using an Arduino Uno or equivalent, you just read and write to the Serial port just as if you were doing so for the Serial Monitor in the IDE. Since we're using an Arduino Mega 2560, which also has hardware support for Serial1, Serial2, and Serial3, we're using Serial1 so we can still use Serial to send diagnostic messages to the Monitor.

I'm going to set up an Instructable or something to make this a little easier. I'll post here when that's done.

Good Luck,
Ray
 


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 02:35.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi