Digital B14
/
ee
ต้นลงหน่อย
Revision 0:f31c1d45c09f, committed 2015-12-05
- Comitter:
- ParinyaT
- Date:
- Sat Dec 05 08:03:37 2015 +0000
- Commit message:
- ??????????
Changed in this revision
diff -r 000000000000 -r f31c1d45c09f eeprom.lib --- /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
diff -r 000000000000 -r f31c1d45c09f main.cpp --- /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); + } + } + +} +
diff -r 000000000000 -r f31c1d45c09f mbed.bld --- /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