Scans the I2C bus and outputs the addresses that were found
Diff: main.cpp
- Revision:
- 1:1d28de04ff26
- Parent:
- 0:c801d9233d33
diff -r c801d9233d33 -r 1d28de04ff26 main.cpp --- a/main.cpp Tue Jun 27 13:36:38 2017 +0000 +++ b/main.cpp Tue Jul 11 08:48:42 2017 +0000 @@ -15,7 +15,7 @@ int ack; unsigned char address; for (address = 1; address < 127; address++) { - ack = i2c.write(address << 1, data, 1); // address is shifted to the left to leave room for the last R/W bit + ack = i2c.write(address << 1, data, 1); // address is shifted to the left, because mbed uses 8bits if (ack == 0) { pc.printf("Sent 0x%X; 0x%X ACK \r\n", address << 1, address); // Send command string }