for use with NXP LPC1768 Microcontroller mbed application board. The programme Reads the LM75B sensor temperature and Pot1 analogue input as room temp and thermostat temp setting respectively. Displays the temp and thermostat readings on LCD display and switches LED 1,2 and 4 on and off to indicated too hot, too cold and heater on or off.
Dependencies: C12832_lcd LM75B mbed
Revision 0:b818a72ebb42, committed 2013-12-29
- Comitter:
- rostam
- Date:
- Sun Dec 29 16:42:37 2013 +0000
- Child:
- 1:4a768c18e543
- Commit message:
- Initial issue of the programme. The programme uses the LM75B sensor to measure the room temperature and switches appropriate LEDs on when too hot or too cold. It uses Pot 1 analogue input of the NXP LPC1768 Microcontroller mbed application board to si...
Changed in this revision
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/C12832_lcd.lib Sun Dec 29 16:42:37 2013 +0000 @@ -0,0 +1,1 @@ +https://mbed.org/users/dreschpe/code/C12832_lcd/#8f86576007d6
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/LM75B.lib Sun Dec 29 16:42:37 2013 +0000 @@ -0,0 +1,1 @@ +https://mbed.org/users/chris/code/LM75B/#6a70c9303bbe
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Sun Dec 29 16:42:37 2013 +0000 @@ -0,0 +1,50 @@ +#include "mbed.h" +#include "C12832_lcd.h" +#include "LM75B.h" + +DigitalOut toohot(LED1); +DigitalOut toocold(LED2); +DigitalOut heater(LED4); + +C12832_LCD disp; +LM75B temp(p28,p27); +AnalogIn therm(p19); + +float room_temp; +float therm_set; + +int main() +{ + toocold=0; + toohot=0; + + while(1) + { + + therm_set=therm.read() *45.0f; + room_temp=temp.read(); + disp.cls(); + disp.locate(0,0); + disp.printf("Thermostat setting: %.2fc", therm_set); + disp.locate(0,10); + disp.printf("Room Temperature: %.2fc", room_temp); + + if (room_temp>24.0f) + { + toocold=0; + toohot=1; + } + else + { + toocold=1; + toohot=0; + } + + if(room_temp<therm_set) + heater=1; + else + heater=0; + + wait(0.1); + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Sun Dec 29 16:42:37 2013 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/a9913a65894f \ No newline at end of file