Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: C12832_lcd EthernetInterface-ansond-patched HTTPClient-thermostat-remotes LM75B MMA7660 SocketIO WebSocketClient-ThermostatDemo mbed-rtos mbed picojson
main.cpp@5:3ab657317bfa, 2013-11-11 (annotated)
- Committer:
- ansond
- Date:
- Mon Nov 11 20:35:49 2013 +0000
- Revision:
- 5:3ab657317bfa
- Parent:
- 0:26c48388f725
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 | } |