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 MBED_DEMOS

main.cpp

Committer:
ansond
Date:
2013-11-10
Revision:
3:58f1cc293901
Parent:
0:26c48388f725

File content as of revision 3:58f1cc293901:

#include "mbed.h"

#include "Thermostat.h"

Serial pc(USBTX, USBRX);
Thermostat *thermostat = NULL;

// useful for KEIL Debugging
extern "C" void mbed_mac_address(char * mac) {
  // define your own MAC Address
  mac[0] = 0x00;  
  mac[1] = 0x01;  
  mac[2] = 0x02;  
  mac[3] = 0x03;  
  mac[4] = 0x04;  
  mac[5] = 0x05;           
};

// check for exit
void checkForExit() {
    if (pc.readable()) {
        char c = pc.getc();
        if (c == 0x03) {    // CTRL-C ASCII
            pc.printf("ctrl-c: closing down thermostat...\r\n");
            if (thermostat != NULL) delete thermostat;
            pc.printf("app exiting...\r\n");
            exit(1);
        }
    }
}

int main(int argc, char *argv[]) {
    thermostat = new Thermostat();
    if (thermostat != NULL) thermostat->runDemo();
}