Dreamforce Heroku Sample mbed application for the FRDM-K64F. This application uses SocketIO to connect and communicate with Heroku.
Dependencies: BufferedSerial C12832 EthernetInterface HTTPClient-SSL LM75B MMA7660 SocketIO-k64f WebSocketClient-ThermostatDemo mbed-rtos mbed picojson
Fork of df-2013-minihack-thermostat-complete by
main.cpp@6:74c1e9c8c90e, 2014-10-09 (annotated)
- Committer:
- ansond
- Date:
- Thu Oct 09 16:14:18 2014 +0000
- Revision:
- 6:74c1e9c8c90e
- Parent:
- 0:26c48388f725
updates of the 2013 DF heroku app ported to K64F+appshield
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 | 6:74c1e9c8c90e | 5 | #include "BufferedSerial.h" |
ansond | 6:74c1e9c8c90e | 6 | BufferedSerial pc(USBTX, USBRX); |
ansond | 0:26c48388f725 | 7 | Thermostat *thermostat = NULL; |
ansond | 0:26c48388f725 | 8 | |
ansond | 0:26c48388f725 | 9 | // check for exit |
ansond | 0:26c48388f725 | 10 | void checkForExit() { |
ansond | 0:26c48388f725 | 11 | if (pc.readable()) { |
ansond | 0:26c48388f725 | 12 | char c = pc.getc(); |
ansond | 0:26c48388f725 | 13 | if (c == 0x03) { // CTRL-C ASCII |
ansond | 0:26c48388f725 | 14 | pc.printf("ctrl-c: closing down thermostat...\r\n"); |
ansond | 0:26c48388f725 | 15 | if (thermostat != NULL) delete thermostat; |
ansond | 0:26c48388f725 | 16 | pc.printf("app exiting...\r\n"); |
ansond | 0:26c48388f725 | 17 | exit(1); |
ansond | 0:26c48388f725 | 18 | } |
ansond | 0:26c48388f725 | 19 | } |
ansond | 0:26c48388f725 | 20 | } |
ansond | 0:26c48388f725 | 21 | |
ansond | 0:26c48388f725 | 22 | int main() { |
ansond | 0:26c48388f725 | 23 | thermostat = new Thermostat(); |
ansond | 0:26c48388f725 | 24 | if (thermostat != NULL) thermostat->runDemo(); |
ansond | 0:26c48388f725 | 25 | } |