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
- Committer:
- MACRUM
- Date:
- 2018-04-23
- Revision:
- 1:2651ad0f52c0
- Parent:
- 0:81685bb49271
- Child:
- 2:85afa5129e56
File content as of revision 1:2651ad0f52c0:
#include "mbed.h" DigitalOut led1(LED1); Serial pc(USBTX, USBRX); I2C i2c(D14, D15); // main() runs in its own thread in the OS int main() { char buf[10]; buf[0] = 0; pc.printf(" 0 1 2 3 4 5 6 7 8 9 a b c d e f\n"); for (int adrs = 0; adrs < 0x80; adrs += 16) { pc.printf("%02x: ", adrs); for (int i = 0; i < 16; i++) { i2c.write(((adrs + i) << 1), buf, 1); int ret = i2c.read(((adrs + i) << 1), buf, 2); if ((adrs+i) == 0 || (adrs+i) == 1 || (adrs+i) == 2) { pc.printf(" "); continue; } if ((adrs+i) >= 0x78) { pc.printf("\n"); break; } if (ret == 1) { pc.printf("-- "); } if (ret == 0) { pc.printf("%02x ", (adrs + i) << 1); } } pc.printf("\n"); } while (true) { led1 = !led1; wait(0.5); } }