example code using statis library for temperature measurement with LM35 and LM335

Dependencies:   mbed statis

main.cpp

Committer:
greletj
Date:
2012-11-22
Revision:
3:0e06300940cd
Parent:
2:9517837c642d
Child:
4:ffc39af07ade

File content as of revision 3:0e06300940cd:

#include "mbed.h"
#include "nimh.h"
#include "tickerEvent.h"
#include "temperatureSensor.h"

Serial pc(USBTX, USBRX);

// tickerEvent initialisation
tickerEvent led1(LED1, 0.1);
//tickerEvent led2(LED2, 0.9);
//tickerEvent led3(LED3, 0.7);
//tickerEvent led4(LED4, 0.1);

// temperature sensor intialisation
// LM35 temperature sensor out is connected to Mbed pin : p19
temperatureSensor LM35(p19, 0.1, 0, MEDIAN, 5);

// LM335 temperature sensor out is connected to Mbed pin : p20
temperatureSensor LM335(p20, 0.1, 273.15, MEDIAN, 5);

// main program
int main() {
    pc.printf("\r\nStarting ...\r\n");
    while (1) {
    //for ( int i = 0; i < 5; i++ ) { 
       //pc.printf("Status LED1: %d\r\n", led1.read());
       wait(0.5);
       pc.printf("LM35: %5.2f degrees  ", LM35.read());
       pc.printf("LM335: %5.2f degrees\r\n", LM335.read());
    }
    //pc.printf("End ...\r\n");
}