lab6

Dependencies:   eeprom mbed

Fork of FRA221_lab6 by Wasuthorn Ausrivong

Files at this revision

API Documentation at this revision

Comitter:
wonner163
Date:
Thu Nov 23 14:53:01 2017 +0000
Commit message:
lab6

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 7bcaa36776b1 eeprom.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/eeprom.lib	Thu Nov 23 14:53:01 2017 +0000
@@ -0,0 +1,1 @@
+https://developer.mbed.org/teams/FRA221_2015/code/eeprom/#df82ebf4be54
diff -r 000000000000 -r 7bcaa36776b1 main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Thu Nov 23 14:53:01 2017 +0000
@@ -0,0 +1,34 @@
+#include "mbed.h"
+#include "eeprom.h"
+
+EEPROM memory(I2C_SDA,I2C_SCL,0);
+DigitalIn Logic(D6);
+DigitalIn mybutton(USER_BUTTON);
+BusIn input(D13,D12,D11,D10,D9,D8,D7);
+BusOut output(D5,D4,D3,D2,A0,A1,A2);
+//DigitalIn button(D9);
+//EEPROM abc(I2C_SDA,I2C_SCL,1);
+
+int main()
+{
+    while(1){
+    int16_t value=input.read();
+    int16_t data;
+    if(Logic == 0) {
+            int16_t i=0;
+            if(mybutton == 0){
+                memory.write(i,value);//adress , ใส่ค่าอะไร
+                wait(0.1);
+            }         
+        } 
+    if (Logic == 1)
+        {
+            int16_t i=0;
+            if(mybutton == 0){
+                memory.read(i,data);
+                wait_ms(1);
+                output=data;
+            }
+        }
+    }
+    }
\ No newline at end of file
diff -r 000000000000 -r 7bcaa36776b1 mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Thu Nov 23 14:53:01 2017 +0000
@@ -0,0 +1,1 @@
+https://os.mbed.com/users/mbed_official/code/mbed/builds/e7ca05fa8600
\ No newline at end of file