Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: C12832_lcd LM75B USBDevice mbed
Fork of app-board-TempAlarm by
Revision 4:d9371152f77a, committed 2013-09-22
- Comitter:
- 4180_1
- Date:
- Sun Sep 22 17:50:35 2013 +0000
- Parent:
- 3:4d612f16ad84
- Child:
- 5:05597fda1a26
- Commit message:
- ver 1.0 see https://mbed.org/users/4180_1/notebook/mbed-application-board-hands-on-demos/
Changed in this revision
--- a/C12832_lcd.lib Fri Oct 26 21:42:06 2012 +0000 +++ b/C12832_lcd.lib Sun Sep 22 17:50:35 2013 +0000 @@ -1,1 +1,1 @@ -http://mbed.org/users/dreschpe/code/C12832_lcd/#468cdccff7af +http://mbed.org/users/dreschpe/code/C12832_lcd/#c9afe58d786a
--- a/LM75B.lib Fri Oct 26 21:42:06 2012 +0000 +++ b/LM75B.lib Sun Sep 22 17:50:35 2013 +0000 @@ -1,1 +1,1 @@ -http://mbed.org/users/chris/code/LM75B/#6a70c9303bbe +https://mbed.org/users/neilt6/code/LM75B/#fc27dc535ea9
--- a/main.cpp Fri Oct 26 21:42:06 2012 +0000
+++ b/main.cpp Sun Sep 22 17:50:35 2013 +0000
@@ -2,17 +2,43 @@
#include "LM75B.h"
#include "C12832_lcd.h"
-C12832_LCD lcd;
-LM75B tmp(p28,p27);
+C12832_LCD lcd; //Graphics LCD
+LM75B tmp(p28,p27); //I2C Temperature Sensor
+PwmOut r(p23); //RGB LED with 3 PWM outputs for dimmer control
+PwmOut g(p24);
+PwmOut b(p25);
+PwmOut speaker(p26); //Speaker with PWM driver
+AnalogIn pot1(p19); //Reads Pot 1 - near LCD
+AnalogIn pot2(p20); //Reads Pot 2 - near RGB LED
+Serial pc(USBTX,USBRX); //used for printf to PC over USB
int main ()
{
+ float board_temp;
+ float alarm_temp = 0.0;
+ // generate a 800Hz tone using PWM hardware output
+ speaker.period(1.0/800.0); // 800hz period
+ r=1.0; //RGB LED off - PWM 100% duty cycle
+ g=1.0;
+ b=1.0;
while (1) {
lcd.cls();
- lcd.locate(0,3);
- lcd.printf("%.2f\n",tmp.read());
+ lcd.locate(0,0); //clears LCD
+ board_temp = tmp; //read temperature
+ lcd.printf("Board Temperature = %.2f\n\r",board_temp);
+ alarm_temp = 50.0 * pot1; //read alarm temp
+ lcd.printf("Temp Alarm Setting = %.2f\n\r",alarm_temp);
+ if(board_temp > alarm_temp) { //check temp for alarm
+ r = 1.0 - pot2; //RGB LED red
+ g = 1.0;
+ speaker = 0.5; //alarm tone using PWM
+ } else {
+ g = 1.0 - pot2; //RGB LED green
+ r = 1.0;
+ speaker = 0.0;
+ }
wait(1.0);
+ pc.printf("%.2f\n\r",board_temp); //send temp to PC
}
-
}
--- a/mbed.bld Fri Oct 26 21:42:06 2012 +0000 +++ b/mbed.bld Sun Sep 22 17:50:35 2013 +0000 @@ -1,1 +1,1 @@ -http://mbed.org/users/mbed_official/code/mbed/builds/49a220cc26e0 +http://mbed.org/users/mbed_official/code/mbed/builds/a9913a65894f \ No newline at end of file
