...

Dependencies:   C12832 LM75B mbed

Fork of app-board-LM75B by Chris Styles

main.cpp

Committer:
Fleishmachine
Date:
2017-02-15
Revision:
6:4f08697d42cc
Parent:
5:608f2bf4d3f7

File content as of revision 6:4f08697d42cc:


#include "mbed.h"
#include "C12832.h"
 
C12832 lcd(p5, p7, p6, p8, p11);
AnalogIn sensor(p15);       

                         
float multiplier = 50;    // this number got me closest to the reading on my multimeter temp probe
float temp;               // calculated temperature
int count;                // for computing average reading
float total;
float average;
int main() {
    count = 0;
    total = 0.0;
    while (1) {
        // formula is analog reading * multiplier

        temp = sensor.read() * multiplier;
        count++;
        total += temp;
        average = total / count;
        
        lcd.cls();
        lcd.locate(0,3);
        lcd.printf("Temperature= %6.2f \n Average= %5.1f \n", temp  , average );
        wait(1);
    }
}