aboutsummaryrefslogtreecommitdiff
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
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
-rw-r--r--README.md8
-rw-r--r--assignments/mqtt-with-button/mqtt-with-button.md27
-rw-r--r--assignments/mqtt-with-button/mqtt-with-button.pdfbin857368 -> 840375 bytes
3 files changed, 18 insertions, 17 deletions
diff --git a/README.md b/README.md
index f56c480..3726b61 100644
--- a/README.md
+++ b/README.md
@@ -20,7 +20,13 @@ This is the materials for a 1 hour workshop on IoT.
> There are some software that you should have installed, check with
> the person at the Bitraf stand.
-## Assignments
+**Preparations**
+
+* Install Arduino IDE
+* Install the "ESP8266 core" for Arduino, follow the guide on
+ https://github.com/esp8266/Arduino#installing-with-boards-manager.
+
+**Assignments**
* [Blink a LED](assignments/blink-a-led/blink-a-led.pdf)
* [MQTT with button](assignments/mqtt-with-button/mqtt-with-button.pdf)
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