本帖最后由 维博哥哥 于 2016-9-9 15:53 编辑
#include <Wire.h>
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
Wire.begin();
Wire.beginTransmission(0x42>>1);
Wire.write(0x12);
Wire.write(0x80);
Wire.endTransmission();
delay(10);
}
void loop() {
// put your main code here, to run repeatedly:
Wire.beginTransmission(0x42>>1);
Wire.write(0x0a);
Wire.endTransmission();
Wire.requestFrom((0x42>>1), 2);
byte data1 = Wire.read();
byte data2 = Wire.read();
Serial.println(data1,HEX);
Serial.println(data2,HEX);
Serial.println("********");
delay(1000);
}
|