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

Dependencies:   EthernetInterface Milkcocoa_EthernetIF mbed-rtos mbed

Revision:
7:90a62daabce9
Parent:
6:bb5007360554
--- a/main.cpp	Mon Feb 29 09:33:09 2016 +0000
+++ b/main.cpp	Mon Jun 06 03:38:14 2016 +0000
@@ -7,11 +7,11 @@
 // The default setting is for the Simple IoT Board(mbed LPC1114FN28)
 // Please change to fit the platform
 Serial pc(USBTX, USBRX);
-DigitalOut myled(LED1);
+PwmOut myled(LED1);
 
 /************************* Your Milkcocoa Setup *********************************/
 #define MILKCOCOA_APP_ID      "...YOUR_MILKCOCOA_APP_ID..."
-#define MILKCOCOA_DATASTORE   "mbed"
+#define MILKCOCOA_DATASTORE   "LED"
 
 /************* Milkcocoa Setup (you don't need to change this!) ******************/
 
@@ -43,12 +43,6 @@
 	while(1) {
 // void loop() {
 		milkcocoa->loop();
-		
-		DataElement elem = DataElement();
-		elem.setValue("v", 1);
-		
-		milkcocoa->push(MILKCOCOA_DATASTORE, elem);
-		wait(7.0);
 	}
 }
 
@@ -57,5 +51,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