Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem with Wire Library #110

Open
st9040215 opened this issue Oct 18, 2018 · 0 comments
Open

Problem with Wire Library #110

st9040215 opened this issue Oct 18, 2018 · 0 comments

Comments

@st9040215
Copy link

st9040215 commented Oct 18, 2018

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant