Grelet Jacques
/
Ni-MH_V3
example code using statis library for temperature measurement with LM35 and LM335
Diff: main.cpp
- Revision:
- 1:5821fa15d6ca
- Parent:
- 0:5ce1bc75ff24
- Child:
- 2:9517837c642d
--- a/main.cpp Mon Nov 19 20:02:24 2012 +0000 +++ b/main.cpp Tue Nov 20 12:10:39 2012 +0000 @@ -1,5 +1,8 @@ #include "mbed.h" #include "tickerEvent.h" +#include "temperatureSensor.h" + +Serial pc(USBTX, USBRX); // tickerEvent initialisation tickerEvent led1(LED1, 0.5); @@ -7,8 +10,18 @@ tickerEvent led3(LED3, 0.7); tickerEvent led4(LED4, 0.1); +// temperature sensor intialisation +// LM35 temperature sensor out is connected to Mbed pin : p16 +temperatureSensor LM35(p16, 0.1, 0); + +// LM335 temperature sensor out is connected to Mbed pin : p18 +temperatureSensor LM335(p18, 0.1, 273.15); + // main program int main() { - while(1) { + while(1) { + pc.printf("Status LED1: %d\r\n", led1.read()); + wait(0.7); + pc.printf("LM35: %f\r\n", LM35.read()); } }