Hi,
I have a really weird problem, when I run the exmple wire (I2C) scanner from Arduino, I get:
I2C Scanner
Scanning...
I2C device found at address 0x1E !
done
However when I try directly to the 0x1E I get the following error code 2:
received NACK on transmit of address.
Below is my code that i did only modify the example code:
#include <Wire.h>
void setup() {
Wire.begin();
Serial.begin(9600);
while (!Serial); // Leonardo: wait for Serial Monitor
Serial.println("\nI2C Scanner");
}
void loop() {
Serial.println("Scanning...");
byte address = 0x1E;
Wire.beginTransmission(address);
byte error = Wire.endTransmission();
if (error == 0) {
Serial.print("I2C device found at address 0x1E");
} else if (error == 1) {
Serial.print("data too long to fit in transmit buffer.");
}
else if (error == 2) {
Serial.print("received NACK on transmit of address.");
}
else if (error == 3) {
Serial.print("received NACK on transmit of data.");
}
else if (error == 4) {
Serial.print("Unknown error at address 0x");
}
delay(5000); // Wait 5 seconds for next scan
}