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

Committer:
ansond
Date:
Mon Nov 11 20:35:49 2013 +0000
Revision:
5:3ab657317bfa
Parent:
0:26c48388f725
updates

Who changed what in which revision?

UserRevisionLine numberNew contents of line
ansond 0:26c48388f725 1 #include "mbed.h"
ansond 0:26c48388f725 2
ansond 0:26c48388f725 3 #include "Thermostat.h"
ansond 0:26c48388f725 4
ansond 0:26c48388f725 5 Serial pc(USBTX, USBRX);
ansond 0:26c48388f725 6 Thermostat *thermostat = NULL;
ansond 0:26c48388f725 7
ansond 0:26c48388f725 8 // check for exit
ansond 0:26c48388f725 9 void checkForExit() {
ansond 0:26c48388f725 10 if (pc.readable()) {
ansond 0:26c48388f725 11 char c = pc.getc();
ansond 0:26c48388f725 12 if (c == 0x03) { // CTRL-C ASCII
ansond 0:26c48388f725 13 pc.printf("ctrl-c: closing down thermostat...\r\n");
ansond 0:26c48388f725 14 if (thermostat != NULL) delete thermostat;
ansond 0:26c48388f725 15 pc.printf("app exiting...\r\n");
ansond 0:26c48388f725 16 exit(1);
ansond 0:26c48388f725 17 }
ansond 0:26c48388f725 18 }
ansond 0:26c48388f725 19 }
ansond 0:26c48388f725 20
ansond 0:26c48388f725 21 int main() {
ansond 0:26c48388f725 22 thermostat = new Thermostat();
ansond 0:26c48388f725 23 if (thermostat != NULL) thermostat->runDemo();
ansond 0:26c48388f725 24 }