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@3:58f1cc293901, 2013-11-10 (annotated)
- Committer:
- ansond
- Date:
- Sun Nov 10 02:18:02 2013 +0000
- Revision:
- 3:58f1cc293901
- Parent:
- 0:26c48388f725
switched json parser
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 | 3:58f1cc293901 | 8 | // useful for KEIL Debugging |
ansond | 3:58f1cc293901 | 9 | extern "C" void mbed_mac_address(char * mac) { |
ansond | 3:58f1cc293901 | 10 | // define your own MAC Address |
ansond | 3:58f1cc293901 | 11 | mac[0] = 0x00; |
ansond | 3:58f1cc293901 | 12 | mac[1] = 0x01; |
ansond | 3:58f1cc293901 | 13 | mac[2] = 0x02; |
ansond | 3:58f1cc293901 | 14 | mac[3] = 0x03; |
ansond | 3:58f1cc293901 | 15 | mac[4] = 0x04; |
ansond | 3:58f1cc293901 | 16 | mac[5] = 0x05; |
ansond | 3:58f1cc293901 | 17 | }; |
ansond | 3:58f1cc293901 | 18 | |
ansond | 0:26c48388f725 | 19 | // check for exit |
ansond | 0:26c48388f725 | 20 | void checkForExit() { |
ansond | 0:26c48388f725 | 21 | if (pc.readable()) { |
ansond | 0:26c48388f725 | 22 | char c = pc.getc(); |
ansond | 0:26c48388f725 | 23 | if (c == 0x03) { // CTRL-C ASCII |
ansond | 0:26c48388f725 | 24 | pc.printf("ctrl-c: closing down thermostat...\r\n"); |
ansond | 0:26c48388f725 | 25 | if (thermostat != NULL) delete thermostat; |
ansond | 0:26c48388f725 | 26 | pc.printf("app exiting...\r\n"); |
ansond | 0:26c48388f725 | 27 | exit(1); |
ansond | 0:26c48388f725 | 28 | } |
ansond | 0:26c48388f725 | 29 | } |
ansond | 0:26c48388f725 | 30 | } |
ansond | 0:26c48388f725 | 31 | |
ansond | 3:58f1cc293901 | 32 | int main(int argc, char *argv[]) { |
ansond | 0:26c48388f725 | 33 | thermostat = new Thermostat(); |
ansond | 0:26c48388f725 | 34 | if (thermostat != NULL) thermostat->runDemo(); |
ansond | 0:26c48388f725 | 35 | } |