Intermittent Leds, depends of the value of an analog pin

Dependencies:   mbed

main.cpp

Committer:
gcarmonar
Date:
2013-10-09
Revision:
0:c3e16ba86b4d

File content as of revision 0:c3e16ba86b4d:

#include "mbed.h"

PwmOut rled(LED3);
PwmOut bled(LED1);
AnalogIn pot(A0);

float pot_time;

int main() {

rled = 1;
bled = 1;

    while(1) {
        pot_time = (pot * .450) + 0.050;
        rled = 1;
        bled = 0;
        wait(pot_time);
        rled = 0;
        bled = 1;
        wait(pot_time);
    }
}