1.21 I2C Transmission Error
-
I am trying to send a byte value to an Arduino in order for it to activate a feature i am working on. Sending "M260 A2 B49" which should send the byte "1" to the Arduino at address 2. Sending it gives an "Error: M260: I2C transmission error"
My arduino is started with "Wire.begin(2);" which adds the Arduino to the I2C bus on address 2.
Not sure what the issue is or how to fix it.
Here is my Arduino code if this helps:
#include <Wire.h> //starts the library
#define LED_1 13
int x = 0; // give a value to the varable to be change with I/Osvoid setup() {
Serial.begin(9600); // used to debug
Wire.begin(2); // Start I2C Bus as a Slave (Device Number 9)
Wire.onReceive(receiveEvent); // register event
pinMode(LED_1, OUTPUT);
for (int i = 0; i < 2; i++)
{
digitalWrite(LED_1, HIGH);
delay(200);
digitalWrite(LED_1, LOW);
delay(200);
}
}void loop ()
{
Serial.println(x);
if (x == 1) {
digitalWrite(LED_1, HIGH);
delay(200);
digitalWrite(LED_1, LOW);
delay(200);
}
}void receiveEvent()
{
x = Wire.read(); // receive byte as an integer
} -
Is it a 3.3V Arduino, or are you using bidirectional level shifters between the Duet and the Arduino?
-
The board is an Arduino Due which is a 3.3V System.
I can try an Uno with a 5V level shifter.
-
That should be OK then. How long are the I2C wires between the Duet and the Arduino? Can you confirm that you have 3 wires between the two: ground, I2C clock, and I2C data?