mirror of
https://github.com/arduino/Arduino.git
synced 2024-12-01 12:24:14 +01:00
Merge pull request #3109 from agdl/fix_i2cexamples
Fix for #2969 (I2C reserved addresses)
This commit is contained in:
commit
c14d4fa8b4
@ -20,7 +20,7 @@ void setup()
|
||||
|
||||
void loop()
|
||||
{
|
||||
Wire.requestFrom(2, 6); // request 6 bytes from slave device #2
|
||||
Wire.requestFrom(8, 6); // request 6 bytes from slave device #8
|
||||
|
||||
while (Wire.available()) // slave may send less than requested
|
||||
{
|
||||
|
@ -21,7 +21,7 @@ byte x = 0;
|
||||
|
||||
void loop()
|
||||
{
|
||||
Wire.beginTransmission(4); // transmit to device #4
|
||||
Wire.beginTransmission(8); // transmit to device #8
|
||||
Wire.write("x is "); // sends five bytes
|
||||
Wire.write(x); // sends one byte
|
||||
Wire.endTransmission(); // stop transmitting
|
||||
|
@ -14,7 +14,7 @@
|
||||
|
||||
void setup()
|
||||
{
|
||||
Wire.begin(4); // join i2c bus with address #4
|
||||
Wire.begin(8); // join i2c bus with address #8
|
||||
Wire.onReceive(receiveEvent); // register event
|
||||
Serial.begin(9600); // start serial for output
|
||||
}
|
||||
|
@ -14,7 +14,7 @@
|
||||
|
||||
void setup()
|
||||
{
|
||||
Wire.begin(2); // join i2c bus with address #2
|
||||
Wire.begin(8); // join i2c bus with address #8
|
||||
Wire.onRequest(requestEvent); // register event
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user