Thinger IO Cloude Service Test Example with WIZwiki-W7500

Dependencies:   DHT WIZnetInterface mbed-src

Smart WIZwiki_W7500 IoT platform with the Open source IoT Cloud server thinger.io

http://wiznetmuseum.com/wp/wp-content/uploads/2015/09/WIZwiki_W7500_thingerio.png

Overview

This project is based on mbed WIZwiki-W7500 platform launced by WIZnet. WIZwiki-W7500 can connect to the smart IoT cloud server called thinger.io.

Demos

Video

For more detail

http://midnightcow.tistory.com/entry/mbed-WIZwikiW7500-platform-with-Smart-IoT-Cloud-Server-Thingerio

Revision:
0:58cf74f2fc63
Child:
1:fa957f28633b
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Mon Sep 21 07:27:24 2015 +0000
@@ -0,0 +1,101 @@
+#include "mbed.h"
+#include "EthernetInterface.h"
+#include "DHT.h"
+
+#include "TCPSocketConnectionArdu.h"
+#include "ThingerEthernet.h"
+#include "ThingerClient.h"
+
+
+/* ThingerIO Define */
+#define USERNAME "MidnightCow"
+#define DEVICE_ID "WIZwiki_W7500_mbed_01"
+#define DEVICE_CREDENTIAL "WIZwiki_W7500_mbed_dkagh1234"
+
+/* YUROBOT SHILED1 PIN Define*/
+#define myLED1      D13
+#define myLED2      D12
+
+#define myRLED      D9
+#define myGLED      D10
+#define myBLED      D11
+
+#define myBUZZ      D5
+
+#define myTEMPHUMM  D4
+
+#define myLIGHT     A1
+
+//using namespace std;
+DigitalOut myled1(myLED1);
+DigitalOut myled2(myLED2);
+
+DigitalOut myrled(myRLED);
+DigitalOut mygled(myGLED);
+DigitalOut mybled(myBLED);
+
+AnalogIn   mylight(myLIGHT);
+
+DHT myTempHumm(myTEMPHUMM, DHT11);
+
+
+ThingerEthernet thing(USERNAME, DEVICE_ID, DEVICE_CREDENTIAL);
+
+void setup() {
+    // resource input example (i.e. turning on/off a light, a relay, configuring a parameter, etc)
+    thing["myled1"] << [](pson& in){ myled1 = (in) ? 0 : 1; };
+
+    // resource output example (i.e. reading a sensor value)
+//    thing["millis"] >> [](pson& out){ out = millis(); };
+
+    // resource input/output example (i.e. passing input values and do some calculations)
+//   thing["in_out"] = [](pson& in, pson& out){
+//      out["sum"] = (long)in["value1"] + (long)in["value2"];
+//      out["mult"] = (long)in["value1"] * (long)in["value2"];
+//    };
+}
+
+
+int main() {
+    int err;
+    while(1) {
+        myled1 = 1;
+        wait(0.2);
+        myled1 = 0;
+        wait(0.2);
+        myled2 = 1;
+        wait(0.2);
+        myled2 = 0;
+        wait(0.2);
+        myrled = 0;
+        mygled = 0;
+        mybled = 0;
+        wait(0.5);
+        myrled = 0;
+        mygled = 1;
+        mybled = 1;
+        wait(0.5);
+        myrled = 1;
+        mygled = 0;
+        mybled = 1;
+        wait(0.5);
+        myrled = 1;
+        mygled = 1;
+        mybled = 0;
+        wait(0.5);
+
+        err = myTempHumm.readData();
+        if (err == 0) {
+            printf("Temperature is %4.2f C \r\n", myTempHumm.ReadTemperature(CELCIUS));
+            printf("Temperature is %4.2f F \r\n", myTempHumm.ReadTemperature(FARENHEIT));
+            printf("Humidity is %4.f % \r\n", myTempHumm.ReadHumidity());
+            printf("Dew point is %4.2f  \r\n",myTempHumm.CalcdewPoint(myTempHumm.ReadTemperature(CELCIUS), myTempHumm.ReadHumidity()));
+            printf("Dew point (fast) is %4.2f  \r\n\n",myTempHumm.CalcdewPointFast(myTempHumm.ReadTemperature(CELCIUS), myTempHumm.ReadHumidity()));
+        }
+        else {
+            printf("\r\nErr %i \n", err);    
+        }
+        wait(1);
+        thing.handle();
+    }
+}