We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
// 引入Wire库文件 #include <Wire.h> void setup() { // Wire初始化, 加入i2c总线 // 如果未指定,则以主机身份加入总线。 Wire.begin(); // 初始化串口并设置波特率为9600 Serial.begin(9600); } void loop() { Wire.beginTransmission(90); Wire.write(34); int error = Wire.endTransmission(0); delay(200); if (error != 0) { Serial.println(error); } else { byte a = Wire.requestFrom(90,1); Serial.print(a); // 当从从设备接收到信息时值为true while (Wire.available()) { // 接受并读取从设备发来的一个字节的数据 char c = Wire.read(); // 向串口打印该字节 Serial.print(c); } } // 延时500毫秒 delay(500); }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
一直无法读取I2C的数据,比如left的button,使用arduinoIDE,代码如下:
The text was updated successfully, but these errors were encountered: