ต้นลงหน่อย

Dependencies:   eeprom mbed

Files at this revision

API Documentation at this revision

Comitter:
ParinyaT
Date:
Sat Dec 05 08:03:37 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
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/eeprom.lib	Sat Dec 05 08:03:37 2015 +0000
@@ -0,0 +1,1 @@
+https://developer.mbed.org/teams/FRA221_2015/code/eeprom/#c648c5e93d5e
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Sat Dec 05 08:03:37 2015 +0000
@@ -0,0 +1,48 @@
+#include "mbed.h"
+#include "eeprom.h"
+
+EEPROM memory(I2C_SDA,I2C_SCL,0);
+DigitalIn mod(D2);
+InterruptIn send(D11);
+BusIn data(D3,D4,D5,D6,D7,D8,D9);
+BusOut Led(A5,A4,A3,A2,A1,A0,D10);
+Serial pc(D1,D0);
+int8_t out,write;
+
+void eewrite()
+{
+        write = data;
+        memory.write(0xFF,write);
+        pc.printf("%x\n",write);
+                
+        wait_ms(10);
+}
+
+void eeread()
+{
+            memory.read(0xFF,out);
+            pc.printf("%x\n",out);
+            Led = out;
+                
+            wait_ms(10);
+}
+    
+
+int main()
+{
+    while(1)
+    {
+        if(mod==1)
+        {
+            send.rise(eewrite);
+            wait_ms(10);
+        }
+        else if(mod==0)
+        {
+            send.rise(eeread);
+            wait_ms(10);
+        }
+    }
+    
+}
+    
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Sat Dec 05 08:03:37 2015 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/9296ab0bfc11
\ No newline at end of file