Dreamforce 2013 MiniHack Thermostat Challenge - completed code

Dependencies:   C12832_lcd EthernetInterface-ansond-patched HTTPClient-thermostat-remotes LM75B MMA7660 SocketIO WebSocketClient-ThermostatDemo mbed-rtos mbed picojson

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 #include "mbed.h"
00002 
00003 #include "Thermostat.h"
00004 
00005 Serial pc(USBTX, USBRX);
00006 Thermostat *thermostat = NULL;
00007 
00008 // check for exit
00009 void checkForExit() {
00010     if (pc.readable()) {
00011         char c = pc.getc();
00012         if (c == 0x03) {    // CTRL-C ASCII
00013             pc.printf("ctrl-c: closing down thermostat...\r\n");
00014             if (thermostat != NULL) delete thermostat;
00015             pc.printf("app exiting...\r\n");
00016             exit(1);
00017         }
00018     }
00019 }
00020 
00021 int main() {
00022     thermostat = new Thermostat();
00023     if (thermostat != NULL) thermostat->runDemo();
00024 }