Scans the I2C bus and outputs the addresses that were found

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
ElectronicsSanta
Date:
Tue Jul 11 08:48:42 2017 +0000
Parent:
0:c801d9233d33
Commit message:
text correction

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
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
         }