Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
main.cpp
00001 #include "mbed.h" 00002 00003 00004 #define D_SDA I2C_SDA 00005 #define D_SCL I2C_SCL 00006 00007 I2C i2c(D_SDA, D_SCL); 00008 00009 Serial pc(SERIAL_TX, SERIAL_RX); 00010 00011 char data [255]; 00012 int i; 00013 int main() 00014 { 00015 pc.printf("started.. \n"); 00016 // Scan for I2C devices that reply with ack 00017 for (i=0; i<=254; i=i+2) { 00018 if (i2c.read(i, &data[0], 1) ==0) 00019 { 00020 pc.printf("I2C device detected at address=%2.2X\n\r", i); 00021 } 00022 } 00023 }
Generated on Fri Jul 15 2022 06:50:56 by
1.7.2