Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Revision 0:03b8ccce5261, committed 2015-11-16
- Comitter:
- NorNick
- Date:
- Mon Nov 16 17:08:59 2015 +0000
- Commit message:
- Finish
Changed in this revision
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/eeprom.lib Mon Nov 16 17:08:59 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 Mon Nov 16 17:08:59 2015 +0000 @@ -0,0 +1,84 @@ +#include "mbed.h" +#include "eeprom.h" + +EEPROM memory(I2C_SDA,I2C_SCL,0); +BusIn NobitaX(PA_10, PB_3, PB_5, PB_4, PB_10, PA_8, PA_9); +BusOut LEDs(PB_13, PB_14, PB_15, PB_1,PB_2,PB_12,PA_11); +DigitalIn DeBounce(PA_5),SW(PC_7); +//DigitalIn SW(PC_7); + +int main(void) +{ + int16_t i,a=1,b=0,j=0; + //int16_t data[100];//1-99 + int16_t x=0; + int16_t c=SW.read(); + int16_t bit[8]={0}; + int16_t dec=0; + + printf("Hello NucleO! %d\n",i); + while(1) + { + if(SW.read()==1)//WRITH DATA + { + if(c!=0) + { + printf("insert data \n"); + c=0;i=1; + } + if(DeBounce.read() == 1) + { + memory.write(i,NobitaX.read()); + wait_ms(1); + printf("%d , ",NobitaX.read()); + /******DCB_TO_BIN_CODE*************/ + dec = NobitaX.read(); + do{ + bit[b++] = dec % 2; + dec = dec / 2; + }while (dec > 0); + for(j = b - 1; j >= 0; j--) + printf("%d", bit[j]); + printf(" , %d \n",i); + /****************************/ + while(DeBounce.read() == 1){} + i++; + } + a=1; + j=b=0; + } + else //READ DATA + { + if(c==0) + { + printf("LEAD Input EEProm\n"); + c++; + } + if(DeBounce.read() == 1) + { + memory.read(a,x); + LEDs = x; + printf("%d , ",LEDs.read()); + /******DCB_TO_BIN_CODE*************/ + dec = LEDs.read(); + do{ + bit[b++] = dec % 2; + dec = dec / 2; + }while (dec > 0); + for(j = b - 1; j >= 0; j--) + printf("%d", bit[j]); + printf(" , %d \n",a); + /****************************/ + while(DeBounce.read() == 1){} + if(i!=0) + { + if(a>i)a=1; + else a++; + } + else + a++; + } + j=b=0; + } + } +} \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Mon Nov 16 17:08:59 2015 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/9296ab0bfc11 \ No newline at end of file