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.
Diff: main.cpp
- Revision:
- 0:f971dfcdb7ad
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp Thu Feb 04 10:34:43 2016 +0000
@@ -0,0 +1,23 @@
+#include "mbed.h"
+
+
+#define D_SDA I2C_SDA
+#define D_SCL I2C_SCL
+
+I2C i2c(D_SDA, D_SCL);
+
+Serial pc(SERIAL_TX, SERIAL_RX);
+
+char data [255];
+int i;
+int main()
+{
+ pc.printf("started.. \n");
+ // Scan for I2C devices that reply with ack
+ for (i=0; i<=254; i=i+2) {
+ if (i2c.read(i, &data[0], 1) ==0)
+ {
+ pc.printf("I2C device detected at address=%2.2X\n\r", i);
+ }
+ }
+ }