Doug Anson / Mbed 2 deprecated df-2014-heroku-thermostat-k64f

Dependencies:   BufferedSerial C12832 EthernetInterface HTTPClient-SSL LM75B MMA7660 SocketIO-k64f WebSocketClient-ThermostatDemo mbed-rtos mbed picojson

Fork of df-2013-minihack-thermostat-complete by MBED_DEMOS

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 #include "mbed.h"
00002 
00003 #include "Thermostat.h"
00004 
00005 #include "BufferedSerial.h"
00006 BufferedSerial pc(USBTX, USBRX);
00007 Thermostat *thermostat = NULL;
00008 
00009 // check for exit
00010 void checkForExit() {
00011     if (pc.readable()) {
00012         char c = pc.getc();
00013         if (c == 0x03) {    // CTRL-C ASCII
00014             pc.printf("ctrl-c: closing down thermostat...\r\n");
00015             if (thermostat != NULL) delete thermostat;
00016             pc.printf("app exiting...\r\n");
00017             exit(1);
00018         }
00019     }
00020 }
00021 
00022 int main() {
00023     thermostat = new Thermostat();
00024     if (thermostat != NULL) thermostat->runDemo();
00025 }