Using the RoboRIO's Serial Ports

The roboRIO has two serial ports: one in the MXP using TTL (pins 10 and 14) and another dedicated serial port using RS232.

Port Number
RS232 Serial
TTL Serial (MXP)

The Interface team (Sensors-Software Communication Squad) (Nathan and Alex, with help from Mr. Albert) have gotten TTL communication working with an Arduino at 57600 baud. Example code is available in the Robot project in the test (not FIRST!) SVN repository. Sensors is currently using a protocol where data from all of the sensors is sent in one packet in the format: <Sensorname:value!Sensorname:value!Sensorname:value!>. The exclamation points are used to separate the various sensors. The code is sent out as bytes from the Arduino, and is converted to UTF-8 (with UNIX line endings) by the robot.

The main class for serial communications is (aptly named) SerialCommunication?.java. This class's purpose is to receive the latest complete serial message via raw bytes, convert them to UTF-8, and subsequently parse it via an array, splitting the tags (sensor name) and the values (the numbers returned by the sensors) into separate arrays that are then returned, and sent into the internals of the robot. ALEX: ADD STUFF ABOUT THE STUFF THAT YOU DID

Last modified 7 years ago Last modified on Apr 22, 2015, 7:43:51 PM