I'm trying to read variable values ( 0 to 255) on the Arduino UNO, and sent them to the EV3 to be used as control values in the EV3 program.
Elsewhere in the Arduino program suppose I assign values to integers num1 and num2,
I have several questions:
I looked at the sample Arduino code provided on the Dexter Site:
define SLAVE_ADDRESS 0x04
Serial.begin(9600); // start serial for output
void receiveData(int byteCount)
// callback for sending data
(1) How do I transmit num1 and num 2 to the EV3?
Where is the Wire.write command getting its argument from?
The sample code only indicates an address, not a value.
How do I distinguish between two different variables?
If I put a integer number- say 3 or 45- inside the parentheses of the the Wire.write command, it appeared on the screen of the EV3. But when I substituted a variable name, say num1, inside the parentheses, it would display a 0 or -1 instead of the value of the variable.
(2) If a send the number 0 or 1-- does it transmit a 0 or 1 or its ASCII equivalent( 48 or 49)? How do I convert it back?