TP2_exo4

Dependencies:   mbed

Exo4.cpp

Committer:
mbedo
Date:
2014-10-23
Revision:
0:544e5ff343ec

File content as of revision 0:544e5ff343ec:

#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;
        }
    }
}