Nucleo_eeprom

Dependencies:   eeprom mbed

Fork of Nucleo_eeprom by FRA221_2017

Revision:
8:1628d2c67f5e
Parent:
7:8faeff100e3a
Child:
9:70102b54bfcd
--- a/main.cpp	Sun Oct 29 16:05:01 2017 +0000
+++ b/main.cpp	Tue Nov 06 04:14:12 2018 +0000
@@ -7,39 +7,35 @@
 
 int main()
 {
+    //// Initial data to write ///// 
+    int8_t  data_dummy = 'r';
+    int8_t  data[4];
+    float   x = 0.0f; 
+    float   j = 9785.26844;    
 
-    int8_t data_dummy='r';
-    int8_t data[4];
-    float x=0.0f,j=9785.26844;
-    
-    int16_t y=0x3321,z;
-
+    //// Write data to Address 1 and 2 
     memory.write(1,(int8_t)data_dummy);
     wait_ms(1);
-
     memory.write(2,(int8_t)'c');
     wait_ms(1);
-    memory.read(1,data,2);
+    
+    /// Read data from address 1 to 4, and store in data array  
+    memory.read(1,data,4);
     wait_ms(1);
+    
+    printf("read[1] = %c\n",data[0]);
+    printf("read[2] = %c\n",data[1]);
+    printf("read[3] = %c\n",data[2]);
+    printf("read[4] = %c\n",data[3]);
 
-
+    //// Write float data 
     memory.write(10,j);
     wait_ms(1);
 
+    //// Read float data, and store to x 
     memory.read(10,x);
     wait_ms(1);
-
-
-    memory.write(1,(int16_t)y);
-    wait_ms(1);
-    memory.read(1,z);
-    wait_ms(1);
-
-    printf("read[1] = %c\n",data[0]);
-    printf("read[2] = %c\n",data[1]);
-
+    
     printf("float = %f\n",x);
 
-    printf("int16 =%d\n",z);
-
 }
\ No newline at end of file