opp

Dependencies:   mbed

Fork of LAB11_Oppgave01 by EL-POM1001

Files at this revision

API Documentation at this revision

Comitter:
knut_johan
Date:
Tue Dec 08 15:43:46 2015 +0000
Parent:
1:2d9d32fc4f5d
Commit message:
LAB11_

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/main.cpp	Tue Nov 10 13:25:36 2015 +0000
+++ b/main.cpp	Tue Dec 08 15:43:46 2015 +0000
@@ -3,10 +3,13 @@
 I2C i2cBus(I2C_SDA, I2C_SCL);
  
 int main()
-{
+{       int i2cAddres;
        i2cBus.frequency(100000);
        
-       int i2cAddres=0x68;                // Address of DS1307 is 0x68 (7 bit address)
+       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);  
@@ -15,6 +18,7 @@
        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);              
+            printf("I2C device Not found at address 0x%02X         \r\n", i2cAddres);  
+            }            
 }