Sample program to get ambient temperature from MCP9700 sensor
Fork of TempSensor by
Revision 1:6a589f1dd263, committed 2013-06-17
- Comitter:
- d0773d
- Date:
- Mon Jun 17 06:26:09 2013 +0000
- Parent:
- 0:6dde232b3b3b
- Commit message:
Changed in this revision
TextLCD.lib | Show diff for this revision Revisions of this file |
main.cpp | Show diff for this revision Revisions of this file |
mbed.bld | Show diff for this revision Revisions of this file |
--- a/TextLCD.lib Tue Nov 23 00:46:29 2010 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -http://mbed.org/users/simon/code/TextLCD/#a53b3e2d6f1e
--- a/main.cpp Tue Nov 23 00:46:29 2010 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,28 +0,0 @@ -#include "mbed.h" -#include "TextLCD.h" -#include "LinearTempSensor.h" - -TextLCD lcd(p24, p26, p27, p28, p29, p30, TextLCD::LCD16x2); // RS, E, DB4, DB5, DB6, DB7 -LinearTempSensor sensor(p20); // With default parameters -//LinearTempSensor sensor(p20, 5, LinearTempSensor::MCP9700); // With option parameters - -int main() -{ - float Vout, Tav, To; - - lcd.cls(); - lcd.printf("TEMP:"); - - while(true) - { - Vout = sensor.Sense(); // Sample data (read sensor) - Tav = sensor.GetAverageTemp(); // Calculate average temperature from N samples - To = sensor.GetLatestTemp(); // Calculate temperature from the latest sample - - lcd.locate(5, 0); - lcd.printf("%4.1f", Tav); - printf("Vout:%f Tav:%f To:%f\n\r", Vout, Tav, To); // Debug print - - wait(2.0); - } -}
--- a/mbed.bld Tue Nov 23 00:46:29 2010 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -http://mbed.org/users/mbed_official/code/mbed/builds/e2ac27c8e93e