Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of MilkcocoaSampleESP8266 by
Diff: main.cpp
- Revision:
- 2:d2e4e7ce7a65
- Parent:
- 1:48214b6d7059
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
