View Single Post
  #6   Spotlight this post!  
Unread 12-06-2013, 18:56
armgeek's Avatar
armgeek armgeek is offline
Raspberry Pi Enthusiast
AKA: Tyler Pawlaczyk
FRC #0340 (Greater Rochester Robotics)
Team Role: Programmer
 
Join Date: Mar 2013
Rookie Year: 2011
Location: Rochester, NY
Posts: 10
armgeek is an unknown quantity at this point
Re: Use Sidecar I2C port to communicate with Arduino?

Did some quick googling, found this that should work for i2c on the arduino side.

Code:
#include <Wire.h> 

void setup() 
{ 
  Wire.begin(2);                // join i2c bus with address #2 
  Wire.onRequest(requestEvent); // register event 
  Serial.begin(9600);           // start serial for output 
} 

void loop() 
{ 
  delay(100); 
} 

// function that executes whenever data is received from master 
// this function is registered as an event, see setup() 
void requestEvent() 
{
  static char c = '0';

  Wire.send(c++);
  if (c > 'z')
    c = '0';
}
Also, the i2c libraries for the cRIO only support master mode... With good reason. Conceptually, the cRIO is the master of all of the networks onboard the robot, because it collects data and uses it to move the robot.
__________________
I enjoy ARM processors.
Looking to earn rewards for working on Open-Source projects that help FIRST? You may be interested in the Summer of FIRST 2013 project. More info: 2013.summeroffirst.org
Also, visit my (sparse) blog: rainingbitsandbytes.blogspot.com