Scan I2C address with COM port output
Dependencies: mbed
main.cpp
- Committer:
- bi18rdbi18rd
- Date:
- 2015-12-05
- Revision:
- 0:02e1d738d7ad
File content as of revision 0:02e1d738d7ad:
#include "mbed.h" I2C i2c(I2C_SDA, I2C_SCL); int addr = 0x00; int main() { bool ack; printf("\nstart\n"); i2c.frequency(100000); while(1) { //sent data i2c FIGURE 4-1 ack = i2c.write(addr,0x00,1); wait_us(5); if(!ack) printf("I2C found @ %x\n",addr); if(addr>=0xFF) break; addr++; } printf("stop\n\n"); }