Jason Schilling / Mbed 2 deprecated miniProject7

Dependencies:   mbed TextLCD

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 #include "mbed.h"
00002 #include "Temperature.h"
00003 #include "TextLCD.h"
00004 #include "Tap.h"
00005 
00006 TextLCD lcd(p19, p20, p21, p22, p23, p24);
00007 
00008 int main() {
00009     tempConfig();
00010     tapsConfig();
00011     float temp;
00012     int i;
00013     while(1) {
00014         i = getSetting(i); // gets new value of i when an interrupt (tapping) changes it
00015         switch(i) { // converts to correct units based on the value of i
00016             case 0: temp = readTemp();
00017             break;
00018             case 1: temp = tempKel(temp);
00019             break;
00020             case 2: temp = tempFar(temp);
00021             break;
00022             case 3: temp = tempRan(temp);
00023             break;
00024         }
00025         lcd.printf("%1.2f",temp); // display temperature on the lcd
00026         wait(1); // updates the temperature every one second
00027         lcd.cls();
00028     }
00029 }