![](/media/cache/profiles/5f14615696649541a025d3d0f8e0447f.jpg.50x50_q85.jpg)
ワークショップ用のサンプル
Fork of MilkcocoaSampleESP8266 by
Revision 2:d2e4e7ce7a65, committed 2016-02-27
- 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 |
diff -r 48214b6d7059 -r d2e4e7ce7a65 main.cpp --- 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