|
Re: Reading I2C MXP port on roborio
Quote:
Originally Posted by CSkillet
https://www.arduino.cc/en/Reference/Wire
The Arduino Wire Library for I2C Communications has two functions that are very familiar. They are onReceive() and onRequest.
The roboRIO always acts as the master for all I2C transactions, so the RoboRIO has to tell the Arduino to read AND write values. The onReceive(handler) function tells the Arduino to execute handler when the RoboRIO writes data to the Arduino. The onRequest(handler) functions tells the Arduino to execute handler when the RoboRIO is reading data from the Arduino.
My point is that you have to use onRequest(). Since the Arduino is setup as a slave device, it has to be told by the RoboRIO that it is okay to send data. Otherwise, data will not be sent. Overall, onRequest() is enabling to Arduino to Write values to the RoboRIO, and onReceive() is enabling the Arduino to read values.
|
I believe that this is the correct solution for this issue
__________________
Team 1403: Cougar Robotics (2015 - present)
|