-
Notifications
You must be signed in to change notification settings - Fork 34
Description
I want to achieve I2C Read by using Wire library
Wire.endTransmission(false) always return 4
this code is OK with MEGA 2560 Board
I check this website: https://www.arduino.cc/en/Reference/WireEndTransmission
0:success
1:data too long to fit in transmit buffer
2:received NACK on transmit of address
3:received NACK on transmit of data
4:other error
7697 does not support wire library?
#include <Wire.h>
void setup()
{
Wire.begin();
Wire.setClock(50000L);
Serial.begin(9600);
}
uint8_t address = 0x0A;
uint8_t reg = 0x01;
uint8_t numBtyes = 2;
uint8_t R_code = 0;
uint8_t Buffer[64];
void loop()
{
int i = 0;
Wire.beginTransmission(address);
Wire.write(reg);
Serial.print(Wire.endTransmission(false));
delay(1);
Wire.requestFrom(address, numBtyes );
while(Wire.available())
{
Wire.read();
i++;
}
delay(1000);
}
Environment
- Arduino BSP Version: 1.8.7
- OS(Windows/macOS/Linux): Windows 7
Thanks