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: mbed C12832 LM75B
Diff: main.cpp
- Revision:
- 4:6df97cb10041
- Parent:
- 3:4d612f16ad84
- Child:
- 5:608f2bf4d3f7
diff -r 4d612f16ad84 -r 6df97cb10041 main.cpp
--- a/main.cpp Fri Oct 26 21:42:06 2012 +0000
+++ b/main.cpp Tue Oct 29 06:51:26 2013 +0000
@@ -3,16 +3,25 @@
#include "C12832_lcd.h"
C12832_LCD lcd;
-LM75B tmp(p28,p27);
+LM75B sensor(p28,p27);
+Serial pc(USBTX,USBRX);
int main ()
{
- while (1) {
- lcd.cls();
- lcd.locate(0,3);
- lcd.printf("%.2f\n",tmp.read());
- wait(1.0);
+ //Try to open the LM75B
+ if (sensor.open()) {
+ printf("Device detected!\n");
+
+ while (1) {
+ lcd.cls();
+ lcd.locate(0,3);
+ lcd.printf("Temp = %.3f\n", (float)sensor);
+ wait(1.0);
+ }
+
+ } else {
+ error("Device not detected!\n");
}
}