Go to Post There is nothing that says 'gracious professionalism' like making brunch for your opponents. - Monochron [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

 
Closed Thread
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 17-06-2012, 14:06
apples000's Avatar
apples000 apples000 is offline
Registered User
no team
 
Join Date: Mar 2012
Rookie Year: 2012
Location: United States
Posts: 222
apples000 has a brilliant futureapples000 has a brilliant futureapples000 has a brilliant futureapples000 has a brilliant futureapples000 has a brilliant futureapples000 has a brilliant futureapples000 has a brilliant futureapples000 has a brilliant futureapples000 has a brilliant futureapples000 has a brilliant futureapples000 has a brilliant future
Arduino and cRIO serial connection

I've been working on using an arduino to control lights and maybe read sensors on our robot. I have decided to try to use serial instead of SPI or I2C because there isn't much documentation about the Arduino being the slave for either of them. I believe that the cRIO's serial port uses full voltage RS-232 serial and the arduino uses 5v TTL. I have found an old MAX232 based level converter board that I have laying around and I think that the cRIO will work with it. I know how to connect the Tx and Rx of the cRIO and Arduino, but I don't know if or what I have to do with the other pins. Do I only need ground, tx, and rx, or do I need to connect the others?
  #2   Spotlight this post!  
Unread 17-06-2012, 17:12
Meshbeard's Avatar
Meshbeard Meshbeard is offline
Previously of 422
AKA: Jonas
FRC #0190 (190)
Team Role: Mentor
 
Join Date: Mar 2012
Rookie Year: 2006
Location: Richmond, VA
Posts: 25
Meshbeard is a name known to allMeshbeard is a name known to allMeshbeard is a name known to allMeshbeard is a name known to allMeshbeard is a name known to allMeshbeard is a name known to all
Re: Arduino and cRIO serial connection

I wouldn't abandon the I2C interface yet.
http://wiring.org.co/learning/libraries/ has some examples of how to use the arduino as a slave in an I2C system. Look under "slave sender."
  #3   Spotlight this post!  
Unread 18-06-2012, 16:03
apples000's Avatar
apples000 apples000 is offline
Registered User
no team
 
Join Date: Mar 2012
Rookie Year: 2012
Location: United States
Posts: 222
apples000 has a brilliant futureapples000 has a brilliant futureapples000 has a brilliant futureapples000 has a brilliant futureapples000 has a brilliant futureapples000 has a brilliant futureapples000 has a brilliant futureapples000 has a brilliant futureapples000 has a brilliant futureapples000 has a brilliant futureapples000 has a brilliant future
Re: Arduino and cRIO serial connection

Wow, I had no idea that the arduino could be a slave. I was using an older version of the wire library that did not have good documentation. I would like to use i2c, but I have no idea how to send more than one byte between the two devices. Do you know where I could find an example for sending an integer or a string? I can only seem to find information about sending one byte.
  #4   Spotlight this post!  
Unread 18-06-2012, 18:59
Gdeaver Gdeaver is offline
Registered User
FRC #1640
Team Role: Mentor
 
Join Date: Mar 2004
Rookie Year: 2001
Location: West Chester, Pa.
Posts: 1,370
Gdeaver has a reputation beyond reputeGdeaver has a reputation beyond reputeGdeaver has a reputation beyond reputeGdeaver has a reputation beyond reputeGdeaver has a reputation beyond reputeGdeaver has a reputation beyond reputeGdeaver has a reputation beyond reputeGdeaver has a reputation beyond reputeGdeaver has a reputation beyond reputeGdeaver has a reputation beyond reputeGdeaver has a reputation beyond repute
Re: Arduino and cRIO serial connection

On this page look at the master slave examples for the wire lib.
http://arduino.cc/en/Tutorial/HomePage
  #5   Spotlight this post!  
Unread 18-06-2012, 21:04
apples000's Avatar
apples000 apples000 is offline
Registered User
no team
 
Join Date: Mar 2012
Rookie Year: 2012
Location: United States
Posts: 222
apples000 has a brilliant futureapples000 has a brilliant futureapples000 has a brilliant futureapples000 has a brilliant futureapples000 has a brilliant futureapples000 has a brilliant futureapples000 has a brilliant futureapples000 has a brilliant futureapples000 has a brilliant futureapples000 has a brilliant futureapples000 has a brilliant future
Re: Arduino and cRIO serial connection

Thanks for the quick reply! I understand how it works, but I am unsure how I would go about storing the transmitting information to a variable. From what I understand, it sends one character at a time. Then, for the last one, it will send the end of the line. I think that if I wanted to store the string, I would have to add all of the letters together, then stop when I got the new line. For what I am trying to do, I would like to send several integers. If I sent three integers separated by commas (12,45,65), could I read it using

Code:
void receiveEvent(int howMany)
{
  while(Wire.available()) 
  {
 int a = Wire.parseint(); 
 int b = Wire.parseint(); 
 int c = Wire.parseint(); 

         
  }
  
}
Closed Thread


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 01:45.

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