Switch Science / Mbed 2 deprecated LM75B_LCD_mbedLPC1114FN28

Dependencies:   LM75B SB1602E mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 #include "mbed.h"
00002 #include "LM75B.h"
00003 #include "SB1602E.h"
00004 
00005 //Create an LM75B object at the default address (ADDRESS_0)
00006 LM75B sensor(dp5, dp27);
00007 SB1602E lcd( dp5, dp27);
00008 
00009 int main()
00010 {   
00011     //Try to open the LM75B
00012     if (sensor.open()) {
00013         printf("Device detected!\n");
00014 
00015         while (1) {
00016             lcd.clear();
00017             //Print the current temperature
00018             lcd.printf(0,"Tmp:%.1f\n", (float)sensor);
00019 
00020             //Sleep for 0.5 seconds
00021             wait(0.5);
00022         }
00023     } else {
00024         error("Device not detected!\n");
00025     }
00026 }