Blinky with temp

Fork of random-blinky by George Roussos

main.cpp

Committer:
gkroussos
Date:
2018-05-31
Revision:
1:c685fdca569a
Parent:
0:774078f45f9d

File content as of revision 1:c685fdca569a:

#include "mbed.h"

DigitalOut led1(LED1);
DigitalOut led2(LED2);
DigitalOut led3(LED3);

AnalogIn LM35(P0_2);

// main() runs in its own thread in the OS
// (note the calls to wait below for delays)
int main() {
    float myTemp; 
    led1 = 0;
    led2 = 0;
    led3 = 0;
    while (true) {
        myTemp = ((LM35*3.3)-0.600)*100.0;
        if (myTemp > 10.0) led1 = 1;
        if (myTemp > 15.0) led2 = 1;
        if (myTemp > 20.0) led3 = 1;
        wait(0.5);
    }
}