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 mbed
Diff: main.cpp
- Revision:
- 0:229e08a49858
diff -r 000000000000 -r 229e08a49858 main.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp Sat Feb 28 04:41:34 2015 +0000
@@ -0,0 +1,36 @@
+#include "mbed.h"
+#include "LM75B.h"
+#include "C12832_lcd.h"
+#include <string>
+
+C12832_LCD lcd;
+
+LM75B sensor(p28,p27);
+Serial pc(USBTX,USBRX);
+
+string s[2] = {"hi", "lo"};
+float prevTemp, curTemp;
+string display;
+int count = 1;
+
+int main ()
+{
+ prevTemp = sensor.read();
+ curTemp = prevTemp;
+ display = s[1];
+ while (1) {
+ curTemp = sensor.read();
+ lcd.cls();
+ lcd.locate(0,5);
+ lcd.printf("Temp = %.3f\n", sensor.read());
+ lcd.locate(0,15);
+ if((curTemp - prevTemp) > 2 || (prevTemp - curTemp > 2)){
+ count++;
+ display = s[count % 2];
+ prevTemp = curTemp;
+ }
+ lcd.printf("%s",display);
+ wait(1.0);
+ }
+
+}
\ No newline at end of file