mbed Sensor node for Instrumented Booth over ETH.
Dependencies: EthernetInterface-1 MaxbotixDriver Presence HTU21D_TEMP_HUMID_SENSOR_SAMPLE Resources SHARPIR mbed-rtos mbed-src WDT_K64F nsdl_lib
Fork of Trenton_Switch_LPC1768_ETH by
Diff: main.cpp
- Revision:
- 46:807e9cf63f4c
- Parent:
- 38:9066ab490386
--- a/main.cpp Mon Jun 29 09:05:06 2015 +0000 +++ b/main.cpp Thu Jul 16 13:28:49 2015 +0000 @@ -22,7 +22,7 @@ #include "Watchdog.h" -//Serial pc(USBTX, USBRX); +Serial pc(PTC17,PTC16); #define WATCHDOG_TIMEOUT_SEC 30 //30 seconds #define HEARTBEAT_PERIOD_MS 1000 //1 second... @@ -32,20 +32,20 @@ { /* Initialize network */ #ifdef DHCP - printf("DHCP in use\r\n"); + pc.printf("DHCP in use\r\n"); eth.init(); #else eth.init(IP, MASK, GW); #endif if(eth.connect(30000) == 0) - printf("Connect OK\n\r"); - printf("IP Address:%s ", eth.getIPAddress()); + pc.printf("Connect OK\n\r"); + pc.printf("IP Address:%s ", eth.getIPAddress()); } //Hard Fault Handler (Watchdog) extern "C" void HardFault_Handler() { - printf("Hard Fault!\r\n"); + pc.printf("Hard Fault!\r\n"); NVIC_SystemReset(); } @@ -137,9 +137,9 @@ } else { //UDP //wait(0.25); //Waiting seems to increase reliability of comms... - printf("Received %d bytes\r\n", n); + pc.printf("Received %d bytes\r\n", n); nsdl_result = sn_nsdl_process_coap((uint8_t*)buffer, n, &received_packet_address); - printf("Processed COAP Packet: %d\r\n", nsdl_result); + pc.printf("Processed COAP Packet: %d\r\n", nsdl_result); n = 0; } @@ -151,7 +151,7 @@ // //Registration Tick if(registrationTimer.read_ms() >= RD_UPDATE_PERIOD_MS) { - printf("Time to register...\r\n"); + pc.printf("Time to register...\r\n"); NSP_registration(); registrationTimer.reset(); } @@ -217,10 +217,10 @@ * \return int */ int main() { - printf("Initialising Ethernet...\r\n"); + pc.printf("Initialising Ethernet...\r\n"); // Initialize Ethernet interface first ethernet_init(); - printf("Initialising NSDL...\r\n"); + pc.printf("Initialising NSDL...\r\n"); //Run NSDL... nsdl_run(); //Init Sensors