aboutsummaryrefslogtreecommitdiff
path: root/assignments/mqtt-with-button
diff options
context:
space:
mode:
authorTrygve Laugstøl <trygvis@inamo.no>2018-06-13 21:16:33 +0200
committerTrygve Laugstøl <trygvis@inamo.no>2018-06-13 21:16:33 +0200
commit1c878c3f149f00846bf765427e064126e2c9bc44 (patch)
treedad0a3e72fdc46ea9400610d43f9baa5a8883295 /assignments/mqtt-with-button
parenta4cbbee0671ff20560c31a2f3945b6131496ab2b (diff)
downloadiot-workshop-ndc-2018-1c878c3f149f00846bf765427e064126e2c9bc44.tar.gz
iot-workshop-ndc-2018-1c878c3f149f00846bf765427e064126e2c9bc44.tar.bz2
iot-workshop-ndc-2018-1c878c3f149f00846bf765427e064126e2c9bc44.tar.xz
iot-workshop-ndc-2018-1c878c3f149f00846bf765427e064126e2c9bc44.zip
wip
Diffstat (limited to 'assignments/mqtt-with-button')
-rw-r--r--assignments/mqtt-with-button/mqtt-with-button.md27
-rw-r--r--assignments/mqtt-with-button/mqtt-with-button.pdfbin857368 -> 840375 bytes
2 files changed, 11 insertions, 16 deletions
diff --git a/assignments/mqtt-with-button/mqtt-with-button.md b/assignments/mqtt-with-button/mqtt-with-button.md
index 6b8872b..99995fb 100644
--- a/assignments/mqtt-with-button/mqtt-with-button.md
+++ b/assignments/mqtt-with-button/mqtt-with-button.md
@@ -1,9 +1,10 @@
-# Assignment: MQTT with button
+# Assignment: MQTT with button and LED
## Goals
* Get aquainted with MQTT.
* Publish a message when a button is pressed.
+* Subscribe to a topic to control the LED
## Step 1
@@ -26,7 +27,13 @@ Wire up this schematic on the bread board:
# Step 4
-* Publish a message on button press
+* Publish a message on button press on the topic
+ `ndc/$device-id/button`
+
+# Step 5
+
+* Subscribe to the topic `ndc/$device-id/led` and turn the LED on/off
+ based on the contents of the message.
## Tips
@@ -37,21 +44,9 @@ Creating a `String` from a number:
* `String(123) => "123"`{.cpp}
* Hex formatted: `String(0x123abc, HEX) => "123abc"`{.cpp}
-Some APIs require "plain C strings" aka a `char *`{.cpp}. They can be converted with `String::c_str()`:
+Some APIs require "plain C strings" aka a `char *`{.cpp}. They can be
+converted with `String::c_str()`:
~~~.c++
char *cStr = myString.c_str();
~~~
-
-## Bonus
-
-**1:** Print the heap free size at regular intervals.
-
-**2:** Implement min, max and average temperature over configured interval.
-
-Suggested parameters:
-
-* Sample interval: 2 seconds
-* Publish interval: 10 seconds
-
-**3:** Make sure the values are calculated even if we're reconnecting to the Wi-Fi or MQTT server.
diff --git a/assignments/mqtt-with-button/mqtt-with-button.pdf b/assignments/mqtt-with-button/mqtt-with-button.pdf
index ffb779e..d994803 100644
--- a/assignments/mqtt-with-button/mqtt-with-button.pdf
+++ b/assignments/mqtt-with-button/mqtt-with-button.pdf
Binary files differ