0508Lab_eeprom

Dependencies:   eeprom mbed

Files at this revision

API Documentation at this revision

Comitter:
KongpobMaksap
Date:
Fri Nov 13 18:21:12 2015 +0000
Commit message:
???????????

Changed in this revision

eeprom.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
diff -r 000000000000 -r b122cd813e30 eeprom.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/eeprom.lib	Fri Nov 13 18:21:12 2015 +0000
@@ -0,0 +1,1 @@
+https://developer.mbed.org/teams/FRA221_2015/code/eeprom/#c648c5e93d5e
diff -r 000000000000 -r b122cd813e30 main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Fri Nov 13 18:21:12 2015 +0000
@@ -0,0 +1,42 @@
+#include "mbed.h"
+#include "eeprom.h"
+
+EEPROM memory(I2C_SDA,I2C_SCL,0);
+BusOut LED(D10,D9,D8,D7,D6,D5,D4);
+BusIn SW(A4,A3,A2,A1,A0,D2,D3);
+DigitalIn SWMODE(A5),SWCLK(D12);
+InterruptIn button(D12);
+int DATA[1],ADD1=0,ADD2=0;
+
+ void SUM()
+    {
+    if(SWCLK==1)
+        {
+          
+          if(SWMODE==1) 
+          { 
+            ADD2=0;
+            memory.write(ADD1,(int8_t)SW);
+            wait_ms(1);
+            ADD1=ADD1+1;    
+          }
+        
+          if(SWMODE==0) 
+          {
+            memory.read(ADD2,DATA,1);
+            wait_ms(1);
+            ADD2=ADD2+1;
+            LED = DATA[0] ; 
+            ADD1=0;
+          }     
+        }
+    }
+
+int main()
+{
+    
+    button.rise(&SUM);
+    while(1) 
+    {
+    }
+}
diff -r 000000000000 -r b122cd813e30 mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Fri Nov 13 18:21:12 2015 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/9296ab0bfc11
\ No newline at end of file