データの保存、更新、取得ができるWebサービス「milkcocoa」に接続し、データのプッシュ、送信、取得ができるライブラリを使ったサンプルです。ESP8266版 https://mlkcca.com/

Dependencies:   Milkcocoa mbed

Dependents:   M2m

Revision:
2:d2e4e7ce7a65
Parent:
1:48214b6d7059
--- a/main.cpp	Thu Dec 24 14:09:05 2015 +0000
+++ b/main.cpp	Sat Feb 27 00:12:32 2016 +0000
@@ -8,7 +8,7 @@
 // The default setting is for the Simple IoT Board(mbed LPC1114FN28)
 // Please change to fit the platform
 SoftSerialSendOnry pc(dp10); // tx
-DigitalOut myled(dp18);
+PwmOut myled(dp18);
 
 /************************* WiFi Access Point *********************************/
 
@@ -18,7 +18,7 @@
 /************************* Your Milkcocoa Setup *********************************/
 
 #define MILKCOCOA_APP_ID      "...YOUR_MILKCOCOA_APP_ID..."
-#define MILKCOCOA_DATASTORE   "esp8266"
+#define MILKCOCOA_DATASTORE   "LED"
 
 /************* Milkcocoa Setup (you don't need to change this!) ******************/
 
@@ -51,14 +51,7 @@
 	
 // }
 	while(1) {
-// void loop() {
 		milkcocoa.loop();
-		
-		DataElement elem = DataElement();
-		elem.setValue("v", 1);
-		
-		milkcocoa.push(MILKCOCOA_DATASTORE, elem);
-		wait(7.0);
 	}
 }
 
@@ -67,5 +60,5 @@
     MQTT::Message &message = md.message;
 	DataElement de = DataElement((char*)message.payload);
 	pc.printf("onpush\n\r");
-	pc.printf("%d\n\r",de.getInt("v"));
+	myled = (float)de.getInt("RED") / 100.0f;
 }
\ No newline at end of file