ワークショップ用のサンプル

Dependencies:   Milkcocoa mbed

Fork of MilkcocoaSampleESP8266 by Junichi Katsu

Files at this revision

API Documentation at this revision

Comitter:
jksoft
Date:
Sat Feb 27 00:12:32 2016 +0000
Parent:
1:48214b6d7059
Commit message:
??

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
--- 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