IBMIoTClientEthernetExample for WIZwiki-W7500 platform
Dependencies: MQTT WIZnetInterface mbed-src
Diff: main.cpp
- Revision:
- 4:167fd0256a06
- Parent:
- 2:b1dcfd885d7f
--- a/main.cpp Tue Sep 15 00:44:54 2015 +0000 +++ b/main.cpp Thu Sep 17 04:42:29 2015 +0000 @@ -11,18 +11,17 @@ // Configuration values needed to connect to IBM IoT Cloud #define QUICKSTARTMODE 1 #if (QUICKSTARTMODE) - #define ORG "quickstart" // For a registered connection, replace with your org - #define ID "" // For a registered connection, replace with your id - #define AUTH_TOKEN "" // For a registered connection, replace with your auth-token - #define TYPE DEFAULT_TYPE_NAME // For a registered connection, replace with your type + #define ORG "quickstart" // For a registered connection, replace with your org + #define ID "" // For a registered connection, replace with your id + #define AUTH_TOKEN "" // For a registered connection, replace with your auth-token + #define TYPE DEFAULT_TYPE_NAME // For a registered connection, replace with your type #else - #define ORG "l24fbu" // For a registered connection, replace with your org - #define ID "0008DC1D69F3" // For a registered connection, replace with your id - #define AUTH_TOKEN "4uvlg2&uQRO-WVf_14" // For a registered connection, replace with your auth-token - #define TYPE "WIZwiki-W7500" // For a registered connection, replace with your type + #define ORG "" // For a registered connection, replace with your org + #define ID "" // For a registered connection, replace with your id + #define AUTH_TOKEN "" // For a registered connection, replace with your auth-token + #define TYPE "WIZwiki-W7500" // For a registered connection, replace with your type #endif - #if defined(TARGET_WIZwiki_W7500) //#warning "Compiling for mbed WIZwiki-W7500" #include "WIZwiki-W7500.h" @@ -35,12 +34,11 @@ #define MQTT_MAX_PACKET_SIZE 250 #if defined(TARGET_WIZwiki_W7500) -// PWM: RGB LED control +// RGB LED control void off(); void red(); void green(); void blue(); -//void yellow(); #endif bool quickstartMode = QUICKSTARTMODE; @@ -139,7 +137,8 @@ char buf[250]; - sprintf(buf, "{\"d\":{\"myName\":\"IoT mbed\",\"potentiometer\":%0.4f}}", ain0.read()); + sprintf(buf, "{\"d\":{\"myName\":\"IoT mbed\",\"potentiometer\":%0.3f}}", ain0.read()); + //sprintf(buf, "{\"d\":{\"myName\":\"IoT mbed\",\"potentiometer\":%0.4f}}", ain0.read()); message.qos = MQTT::QOS0; message.retained = false; @@ -247,8 +246,7 @@ } - // LED Blink: By Bluemix - + // Control the LED Blink interval: By Bluemix Node-RED if (blink_interval == 0) off(); else if (count % blink_interval == 0) @@ -259,35 +257,25 @@ } #if defined(TARGET_WIZwiki_W7500) -// PWM: RGB LED control -> DigitalOut +// RGB LED control -> DigitalOut void off() -{ - //r = g = b = 1.0; // 1 is off, 0 is full brightness +{ r = g = b = 1; } void red() -{ - //r = 0.7; g = 1.0; b = 1.0; // 1 is off, 0 is full brightness +{ r = 0; g = 1; b = 1; } void green() -{ - //r = 1.0; g = 0.7; b = 1.0; // 1 is off, 0 is full brightness +{ r = 1; g = 0; b = 1; } void blue() -{ - //r = 1.0; g = 1.0; b = 0.7; // 1 is off, 0 is full brightness +{ r = 1; g = 1; b = 0; } - - -//void yellow() -//{ - //r = 0.7; g = 0.7; b = 1.0; // 1 is off, 0 is full brightness -//} #endif