thibault lottin
/
TP2_exo4
TP2_exo4
Diff: Exo4.cpp
- Revision:
- 0:544e5ff343ec
diff -r 000000000000 -r 544e5ff343ec Exo4.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Exo4.cpp Thu Oct 23 12:14:30 2014 +0000 @@ -0,0 +1,39 @@ +#include "mbed.h" + +AnalogIn ain(p19); +AnalogIn ain2(p20); +DigitalOut led(LED1); +DigitalOut led2(LED2); +DigitalOut led3(LED3); +DigitalOut led4(LED4); + + +int main() { + while (1){ + if(ain > 0.3) { + led = 1; + wait(0.25); + } else { + led = 0; + } + if(ain > 0.25) { + led2 = 1; + wait(0.25); + } else { + led2 = 0; + } + if(ain > 0.2) { + led3 = 1; + wait(0.25); + } else { + led3 = 0; + } + if(ain > 0.15) { + led4 = 1; + wait(0.25); + } else { + led4 = 0; + } + } +} +