An example program for the mbed application board that uses the LM75B to measure the ambient temperature

Dependencies:   mbed C12832 LM75B

Fork of LM75B_test by Tedd OKANO

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 "C12832.h"
00004 
00005 C12832 lcd(p5, p7, p6, p8, p11);
00006 
00007 LM75B sensor(p28,p27);
00008 Serial pc(USBTX,USBRX);
00009 
00010 int main ()
00011 {
00012 
00013     //Try to open the LM75B
00014     if (sensor.open()) {
00015         printf("Device detected!\n");
00016 
00017         while (1) {
00018             lcd.cls();
00019             lcd.locate(0,3);
00020             lcd.printf("Temp = %.3f\n", (float)sensor);
00021             wait(1.0);
00022         }
00023 
00024     } else {
00025         error("Device not detected!\n");
00026     }
00027 
00028 }