diff options
author | Trygve Laugstøl <trygvis@inamo.no> | 2018-06-14 00:11:29 +0200 |
---|---|---|
committer | Trygve Laugstøl <trygvis@inamo.no> | 2018-06-14 00:11:29 +0200 |
commit | 659dbd8d3c0c5ec2d811c0ffc65f1e92eac98782 (patch) | |
tree | 7620caf24bcc4e86a27af4e0803a06042f3848be | |
parent | 5c46fab6cee7568332aef7371212425819d672df (diff) | |
download | iot-workshop-ndc-2018-659dbd8d3c0c5ec2d811c0ffc65f1e92eac98782.tar.gz iot-workshop-ndc-2018-659dbd8d3c0c5ec2d811c0ffc65f1e92eac98782.tar.bz2 iot-workshop-ndc-2018-659dbd8d3c0c5ec2d811c0ffc65f1e92eac98782.tar.xz iot-workshop-ndc-2018-659dbd8d3c0c5ec2d811c0ffc65f1e92eac98782.zip |
wip
17 files changed, 0 insertions, 151 deletions
diff --git a/assignments/old/client1/client1.ino b/assignments/old/client1/client1.ino deleted file mode 100644 index 39eabfe..0000000 --- a/assignments/old/client1/client1.ino +++ /dev/null @@ -1,71 +0,0 @@ -#include <ESP8266WiFi.h> -#include <WiFiUdp.h> - -#include "config.h" - -WiFiUDP Udp; -unsigned int localUdpPort = 5006; -IPAddress host_ip(192, 168, 10, 151); -unsigned int host_port = 5005; - -const int out_buf_len_start = 100; -const int out_buf_len_increment = 100; -const int out_buf_len_max = 2200; - -char buf[out_buf_len_max]; -int out_buf_len; - -static const char alphabet[] = "abcdefghijklmnopqrstuvxyz"; - -unsigned long time_start, time_end; - -void setup() { - Serial.begin(115200); - - Serial.printf("Connecting to %s ", wifi_ssid); - WiFi.begin(wifi_ssid, wifi_password); - while (WiFi.status() != WL_CONNECTED) { - delay(500); - Serial.print("."); - } - Serial.println(" connected"); - - Udp.begin(localUdpPort); - time_start = millis(); - out_buf_len = out_buf_len_start; -} - -void loop() { - - if (millis() > (time_start + 1000)) { - for (int i = 0; i < out_buf_len; i++) { - buf[i] = alphabet[i % sizeof(alphabet) - 1]; - } - out_buf_len += out_buf_len_increment; - if (out_buf_len > out_buf_len_max) { - out_buf_len = out_buf_len_start; - } - Serial.printf("Sending %d bytes to %s:%d\n", out_buf_len, host_ip.toString().c_str(), host_port); - Udp.beginPacket(host_ip, host_port); - Udp.write(buf, out_buf_len); - time_start = millis(); - auto ok = Udp.endPacket(); - - if (!ok) { - Serial.printf("Could not send packet with size %d\n", out_buf_len); - } - } - - int len = Udp.parsePacket(); - if (len) { - time_end = millis(); - Serial.printf("RX %s:%d: size=%d\n", Udp.remoteIP().toString().c_str(), Udp.remotePort(), len); - int len = Udp.read(buf, sizeof(buf)); - Serial.printf("len=%d\n"); - if (len > 0) { - buf[len] = 0; - } - Serial.printf("RTT: %d ms. Payload:%s\n", int(time_end - time_start), buf); - } -} - diff --git a/assignments/old/mqtt2/mqtt2.md b/assignments/old/mqtt2/mqtt2.md deleted file mode 100644 index cfc623a..0000000 --- a/assignments/old/mqtt2/mqtt2.md +++ /dev/null @@ -1,10 +0,0 @@ -# Assignment: MQTT - -## Goal - -Get to know will messages and retained messages. - -## Steps - -1. Implement last will to indicate online status -1. Retained message diff --git a/assignments/old/mqtt2/mqtt2.pdf b/assignments/old/mqtt2/mqtt2.pdf Binary files differdeleted file mode 100644 index fdd47f6..0000000 --- a/assignments/old/mqtt2/mqtt2.pdf +++ /dev/null diff --git a/assignments/old/mqtt3/mqtt3.md b/assignments/old/mqtt3/mqtt3.md deleted file mode 100644 index 2994e9a..0000000 --- a/assignments/old/mqtt3/mqtt3.md +++ /dev/null @@ -1,12 +0,0 @@ -# Assignment: MQTT - -## Goal - -Connect two devices with MQTT - -## Steps - -1. Publish an alert -1. Subscribe to alert topic, blink a led when you get a message -1. Implement subscription to reconfigure device - 1. Change temperature report interval diff --git a/assignments/old/mqtt3/mqtt3.pdf b/assignments/old/mqtt3/mqtt3.pdf Binary files differdeleted file mode 100644 index 179a73e..0000000 --- a/assignments/old/mqtt3/mqtt3.pdf +++ /dev/null diff --git a/assignments/old/network/network.md b/assignments/old/network/network.md deleted file mode 100644 index 8e49b24..0000000 --- a/assignments/old/network/network.md +++ /dev/null @@ -1,7 +0,0 @@ -## Assignment: Network play time - -* Measure round trip time/latency. Measure UDP, TCP. Measure when the - packet size is greater than the MTU - -* Notice variations in RTT - diff --git a/assignments/old/read-a-button/read-a-button.md b/assignments/old/read-a-button/read-a-button.md deleted file mode 100644 index 6a7fcdd..0000000 --- a/assignments/old/read-a-button/read-a-button.md +++ /dev/null @@ -1,14 +0,0 @@ -# Read a button - -## Step 1 - -Wire up this schematic on the bread board: - -![](schematic/read-a-button_schem.pdf) - -![](schematic/read-a-button_bb.pdf) - -## Step 2 - -* Change sampling frequency - diff --git a/assignments/old/read-a-button/read-a-button.pdf b/assignments/old/read-a-button/read-a-button.pdf Binary files differdeleted file mode 100644 index f32eab7..0000000 --- a/assignments/old/read-a-button/read-a-button.pdf +++ /dev/null diff --git a/assignments/old/read-a-button/schematic/read-a-button.fzz b/assignments/old/read-a-button/schematic/read-a-button.fzz Binary files differdeleted file mode 100644 index bb4263a..0000000 --- a/assignments/old/read-a-button/schematic/read-a-button.fzz +++ /dev/null diff --git a/assignments/old/read-a-button/schematic/read-a-button_bb.pdf b/assignments/old/read-a-button/schematic/read-a-button_bb.pdf Binary files differdeleted file mode 100644 index 8473764..0000000 --- a/assignments/old/read-a-button/schematic/read-a-button_bb.pdf +++ /dev/null diff --git a/assignments/old/read-a-button/schematic/read-a-button_schem.pdf b/assignments/old/read-a-button/schematic/read-a-button_schem.pdf Binary files differdeleted file mode 100644 index bc957bc..0000000 --- a/assignments/old/read-a-button/schematic/read-a-button_schem.pdf +++ /dev/null diff --git a/assignments/old/read-temperature/read-temperature.md b/assignments/old/read-temperature/read-temperature.md deleted file mode 100644 index 31a32a8..0000000 --- a/assignments/old/read-temperature/read-temperature.md +++ /dev/null @@ -1,13 +0,0 @@ -# Read the temperature and humidity sensor DHT22 - -## Step 1 - -Wire up this schematic on the bread board: - -![](schematic/read-temperature_schem.pdf) - -![](schematic/read-temperature_bb.pdf) - -## Step 2 - -* Change sampling frequency diff --git a/assignments/old/read-temperature/read-temperature.pdf b/assignments/old/read-temperature/read-temperature.pdf Binary files differdeleted file mode 100644 index f1ec641..0000000 --- a/assignments/old/read-temperature/read-temperature.pdf +++ /dev/null diff --git a/assignments/old/read-temperature/schematic/read-temperature.fzz b/assignments/old/read-temperature/schematic/read-temperature.fzz Binary files differdeleted file mode 100644 index 52a9fa0..0000000 --- a/assignments/old/read-temperature/schematic/read-temperature.fzz +++ /dev/null diff --git a/assignments/old/read-temperature/schematic/read-temperature_bb.pdf b/assignments/old/read-temperature/schematic/read-temperature_bb.pdf Binary files differdeleted file mode 100644 index 79cc8eb..0000000 --- a/assignments/old/read-temperature/schematic/read-temperature_bb.pdf +++ /dev/null diff --git a/assignments/old/read-temperature/schematic/read-temperature_schem.pdf b/assignments/old/read-temperature/schematic/read-temperature_schem.pdf Binary files differdeleted file mode 100644 index d01ab4b..0000000 --- a/assignments/old/read-temperature/schematic/read-temperature_schem.pdf +++ /dev/null diff --git a/assignments/old/read-temperature/solution/read-temperature/read-temperature.ino b/assignments/old/read-temperature/solution/read-temperature/read-temperature.ino deleted file mode 100644 index b261dc5..0000000 --- a/assignments/old/read-temperature/solution/read-temperature/read-temperature.ino +++ /dev/null @@ -1,24 +0,0 @@ -#include <DHT.h> -#include <DHT_U.h> - -const auto DHTPIN = D1; -const auto DHTTYPE = DHT22; - -DHT_Unified dht(DHTPIN, DHTTYPE); - -void setup() { - Serial.begin(115200); - pinMode(D2, INPUT); - pinMode(D0, OUTPUT); -} - -void loop() { - if (digitalRead(D2) == HIGH) { - Serial.println("HIGH"); - } else { - Serial.println("LOW"); - } - digitalWrite(D0, digitalRead(D2)); - delay(100); -} - |