Example program for app shield using the LM75 temperature sensor
Fork of app-shield-LM75B by
Diff: main.cpp
- Revision:
- 6:bb84f3ab523d
- Parent:
- 5:608f2bf4d3f7
- Child:
- 7:80852d9feb4b
diff -r 608f2bf4d3f7 -r bb84f3ab523d main.cpp --- a/main.cpp Thu Feb 06 14:05:51 2014 +0000 +++ b/main.cpp Fri Feb 07 17:44:04 2014 +0000 @@ -2,27 +2,16 @@ #include "LM75B.h" #include "C12832.h" -C12832 lcd(p5, p7, p6, p8, p11); - -LM75B sensor(p28,p27); -Serial pc(USBTX,USBRX); +// Using Arduino pin notation +C12832 lcd(D11, D13, D12, D7, D10); +LM75B sensor(SDA,SCL); int main () { - - //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"); + while (1) { + lcd.cls(); + lcd.locate(0,3); + lcd.printf("Temp = %.1f\n", float(sensor)); + wait(1.0); } - }