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.
Dependencies: mbed
Fork of LAB11_Oppgave01 by
main.cpp
00001 #include "mbed.h" 00002 00003 I2C i2cBus(I2C_SDA, I2C_SCL); 00004 00005 int main() 00006 { int i2cAddres; 00007 i2cBus.frequency(100000); 00008 00009 i2cAddres=0x68; 00010 for(i2cAddres=3;i2cAddres<119;i2cAddres++) // I2C device found at address 0x52 00011 { 00012 // Address of DS1307 is 0x68 (7 bit address) 00013 int i2c8BitAddres= i2cAddres <<1; // Convert to 8bit addressing used by mbed 00014 00015 int result=i2cBus.write(i2c8BitAddres, NULL, 0); 00016 00017 //0 on success (ack), non-0 on failure (nack) 00018 if (result==0) 00019 printf("I2C device found at address 0x%02X \r\n", i2cAddres); 00020 else 00021 printf("I2C device Not found at address 0x%02X \r\n", i2cAddres); 00022 } 00023 } 00024
Generated on Fri Jul 15 2022 03:20:51 by
1.7.2
