Dreamforce 2013 MiniHack Thermostat Challenge - remotes
Dependencies: C12832_lcd EthernetInterface-ansond-patched HTTPClient-thermostat-remotes LM75B MMA7660 SocketIO WebSocketClient-ThermostatDemo mbed-rtos mbed picojson
Fork of df-2013-minihack-thermostat-complete by
main.cpp@6:33f71cf9a04f, 2013-11-11 (annotated)
- Committer:
- ansond
- Date:
- Mon Nov 11 22:46:25 2013 +0000
- Revision:
- 6:33f71cf9a04f
- Parent:
- 0:26c48388f725
- Child:
- 3:58f1cc293901
updates
Who changed what in which revision?
User | Revision | Line number | New 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 | } |