aboutsummaryrefslogtreecommitdiff
path: root/assignments/mqtt
diff options
context:
space:
mode:
authorTrygve Laugstøl <trygvis@inamo.no>2018-04-26 19:02:41 +0200
committerTrygve Laugstøl <trygvis@inamo.no>2018-04-26 19:02:41 +0200
commit09be8a0d1b07dc55a55fea52365c774398658d7d (patch)
tree3eb8fcd1540b64256cb445cc8c8dbd1e5582a0ae /assignments/mqtt
parent129a22667006ec4f7ebca9c9d5b8e4d492103304 (diff)
downloadiot-workshop-ndc-2018-09be8a0d1b07dc55a55fea52365c774398658d7d.tar.gz
iot-workshop-ndc-2018-09be8a0d1b07dc55a55fea52365c774398658d7d.tar.bz2
iot-workshop-ndc-2018-09be8a0d1b07dc55a55fea52365c774398658d7d.tar.xz
iot-workshop-ndc-2018-09be8a0d1b07dc55a55fea52365c774398658d7d.zip
wip
Diffstat (limited to 'assignments/mqtt')
-rw-r--r--assignments/mqtt/mqtt.md44
-rw-r--r--assignments/mqtt/mqtt.pdfbin0 -> 105234 bytes
2 files changed, 44 insertions, 0 deletions
diff --git a/assignments/mqtt/mqtt.md b/assignments/mqtt/mqtt.md
new file mode 100644
index 0000000..e89e88c
--- /dev/null
+++ b/assignments/mqtt/mqtt.md
@@ -0,0 +1,44 @@
+# Assignment: MQTT
+
+## Goal
+
+Get aquainted with MQTT.
+
+## Steps
+
+1. Connect to the Wi-Fi network
+ * Use `WiFi.localIP()`
+
+1. Connect to MQTT broker
+1. Publish temperature
+1. Implement last will to indicate online status
+1. Implement subscription to reconfigure device
+ 1. Change temperature report interval
+
+## Tips
+
+To generate a client id make something with `ESP.getChipId()`{.cpp}
+
+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()`:
+
+~~~.c++
+char *cStr = myString.c_str();
+~~~
+
+## Bonus
+
+**1:** Print the heap 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/mqtt.pdf b/assignments/mqtt/mqtt.pdf
new file mode 100644
index 0000000..aa797bf
--- /dev/null
+++ b/assignments/mqtt/mqtt.pdf
Binary files differ