Quentin LAM
/
ex26
Exo
Revision 0:423cc5f68c56, committed 2018-05-29
- Comitter:
- Quent1nl
- Date:
- Tue May 29 14:16:00 2018 +0000
- Commit message:
- EX26
Changed in this revision
diff -r 000000000000 -r 423cc5f68c56 IHM_V2.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/IHM_V2.lib Tue May 29 14:16:00 2018 +0000 @@ -0,0 +1,1 @@ +http://os.mbed.com/teams/NBoard/code/IHM_V2/#ad91067e3f6d
diff -r 000000000000 -r 423cc5f68c56 Nboard.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Nboard.h Tue May 29 14:16:00 2018 +0000 @@ -0,0 +1,16 @@ +#include "mbed.h" +#include "IHM.h" +#define Ana0 000 +#define Ana1 001 +#define Ana2 010 +#define Ana3 011 +#define Ana4 100 +#define Ana5 101 +#define AnIn 110 +#define Ana7 111 + +DigitalOut led0(PB_3), led1(PA_7),led2(PA_6),led3(PA_5); +DigitalIn bp(PA_9, PullUp),bou1(PA_10,PullUp),bou2(PB_0,PullUp),bou3(PB_7,PullUp); +BusOut Bus8Leds(PB_3,PA_7,PA_6,PA_5,PA_3,PA_1,PA_0,PA_2); +BusOut BusSelMux(PF_0,PF_1,PA_8); +AnalogIn AnaIn(PB_1);
diff -r 000000000000 -r 423cc5f68c56 main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Tue May 29 14:16:00 2018 +0000 @@ -0,0 +1,34 @@ +#include "Nboard.h" + + +IHM ihm; + +int main() +{ + UINT16 val,pota,decal; + float pot; + while(1) { + BusSelMux=Ana7; + wait_us(1); + val=AnaIn.read_u16(); + pot=AnaIn.read(); + pota=val; + decal=val; + pota=pota>>4; + ihm.LCD_gotoxy(0,0); + ihm.LCD_printf("POT=%04X=%3.2f",val,pot); + ihm.LCD_gotoxy(1,0); + ihm.LCD_printf("POT=%X=%5d",pota,pota); + decal=decal>>8; + //Bus8Leds=decal; + if(pot==0.5){ + Bus8Leds=0x0F; + } + if(pot>=0.75){ + Bus8Leds=0x3F; + } + else{ + Bus8Leds=0x00; + } + } +} \ No newline at end of file
diff -r 000000000000 -r 423cc5f68c56 mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Tue May 29 14:16:00 2018 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/5aab5a7997ee \ No newline at end of file