opp
Dependencies: mbed
Fork of LAB11_Oppgave01 by
main.cpp
- Committer:
- knut_johan
- Date:
- 2015-12-08
- Revision:
- 2:3d70a9ba2a58
- Parent:
- 1:2d9d32fc4f5d
File content as of revision 2:3d70a9ba2a58:
#include "mbed.h" I2C i2cBus(I2C_SDA, I2C_SCL); int main() { int i2cAddres; i2cBus.frequency(100000); i2cAddres=0x68; for(i2cAddres=3;i2cAddres<119;i2cAddres++) // I2C device found at address 0x52 { // Address of DS1307 is 0x68 (7 bit address) int i2c8BitAddres= i2cAddres <<1; // Convert to 8bit addressing used by mbed int result=i2cBus.write(i2c8BitAddres, NULL, 0); //0 on success (ack), non-0 on failure (nack) if (result==0) printf("I2C device found at address 0x%02X \r\n", i2cAddres); else printf("I2C device Not found at address 0x%02X \r\n", i2cAddres); } }