diff --git a/1-getting-started/lessons/1-introduction-to-iot/code/wio-terminal/nightlight/app.py b/1-getting-started/lessons/1-introduction-to-iot/code/wio-terminal/nightlight/app.py deleted file mode 100644 index f33ca45e..00000000 --- a/1-getting-started/lessons/1-introduction-to-iot/code/wio-terminal/nightlight/app.py +++ /dev/null @@ -1,20 +0,0 @@ -from counterfit_shims_grove.counterfit_connection import CounterFitConnection -import time -from counterfit_shims_grove.grove_light_sensor_v1_2 import GroveLightSensor -from counterfit_shims_grove.grove_led import GroveLed - -CounterFitConnection.init('127.0.0.1', 5000) - -light_sensor = GroveLightSensor(0) -led = GroveLed(5) - -while True: - light = light_sensor.light - print('Light level:', light) - - if light < 200: - led.on() - else: - led.off() - - time.sleep(1) \ No newline at end of file diff --git a/1-getting-started/lessons/1-introduction-to-iot/wio-terminal.md b/1-getting-started/lessons/1-introduction-to-iot/wio-terminal.md index 6692949b..ea676572 100644 --- a/1-getting-started/lessons/1-introduction-to-iot/wio-terminal.md +++ b/1-getting-started/lessons/1-introduction-to-iot/wio-terminal.md @@ -8,7 +8,7 @@ The [Wio Terminal from Seeed Studios](https://www.seeedstudio.com/Wio-Terminal-p To use your Wio Terminal, you will need to install some free software on your computer. You will also need to update the Wio Terminal firmware before you can connect it to WiFi. -### Task +### Task - setup Install the required software and update the firmware. @@ -32,7 +32,7 @@ The Hello World app for the Wio Terminal will ensure that you have Visual Studio The first step is to create a new project using PlatformIO configured for the Wio Terminal. -#### Task +#### Task - create a PlatformIO project Create the PlatformIO project. @@ -122,7 +122,7 @@ The VS Code explorer will show a number of files and folders created by the Plat You're now ready to write the Hello World app. -#### Task +#### Task - write the Hello World app Write the Hello World app. diff --git a/1-getting-started/lessons/3-sensors-and-actuators/code-actuator/pi/nightlight/app.py b/1-getting-started/lessons/3-sensors-and-actuators/code-actuator/pi/nightlight/app.py index 261e5b62..0e1ccc45 100644 --- a/1-getting-started/lessons/3-sensors-and-actuators/code-actuator/pi/nightlight/app.py +++ b/1-getting-started/lessons/3-sensors-and-actuators/code-actuator/pi/nightlight/app.py @@ -9,7 +9,7 @@ while True: light = light_sensor.ReadVisible print('Light level:', light) - if light < 200: + if light < 300: led.on() else: led.off() diff --git a/1-getting-started/lessons/3-sensors-and-actuators/code-actuator/virtual-device/nightlight/app.py b/1-getting-started/lessons/3-sensors-and-actuators/code-actuator/virtual-device/nightlight/app.py index b7bf75b6..5aca9a1f 100644 --- a/1-getting-started/lessons/3-sensors-and-actuators/code-actuator/virtual-device/nightlight/app.py +++ b/1-getting-started/lessons/3-sensors-and-actuators/code-actuator/virtual-device/nightlight/app.py @@ -12,7 +12,7 @@ while True: light = light_sensor.light print('Light level:', light) - if light < 200: + if light < 300: led.on() else: led.off() diff --git a/1-getting-started/lessons/3-sensors-and-actuators/code-actuator/wio-terminal/nightlight/app.py b/1-getting-started/lessons/3-sensors-and-actuators/code-actuator/wio-terminal/nightlight/app.py index f33ca45e..d45b4dda 100644 --- a/1-getting-started/lessons/3-sensors-and-actuators/code-actuator/wio-terminal/nightlight/app.py +++ b/1-getting-started/lessons/3-sensors-and-actuators/code-actuator/wio-terminal/nightlight/app.py @@ -12,7 +12,7 @@ while True: light = light_sensor.light print('Light level:', light) - if light < 200: + if light < 300: led.on() else: led.off() diff --git a/1-getting-started/lessons/3-sensors-and-actuators/code-actuator/wio-terminal/nightlight/src/main.cpp b/1-getting-started/lessons/3-sensors-and-actuators/code-actuator/wio-terminal/nightlight/src/main.cpp index ae2299f0..6f948db0 100644 --- a/1-getting-started/lessons/3-sensors-and-actuators/code-actuator/wio-terminal/nightlight/src/main.cpp +++ b/1-getting-started/lessons/3-sensors-and-actuators/code-actuator/wio-terminal/nightlight/src/main.cpp @@ -19,7 +19,7 @@ void loop() Serial.print("Light value: "); Serial.println(light); - if (light < 200) + if (light < 300) { digitalWrite(D0, HIGH); } diff --git a/1-getting-started/lessons/3-sensors-and-actuators/code-sensor/wio-terminal/nightlight/app.py b/1-getting-started/lessons/3-sensors-and-actuators/code-sensor/wio-terminal/nightlight/app.py index f33ca45e..d45b4dda 100644 --- a/1-getting-started/lessons/3-sensors-and-actuators/code-sensor/wio-terminal/nightlight/app.py +++ b/1-getting-started/lessons/3-sensors-and-actuators/code-sensor/wio-terminal/nightlight/app.py @@ -12,7 +12,7 @@ while True: light = light_sensor.light print('Light level:', light) - if light < 200: + if light < 300: led.on() else: led.off() diff --git a/1-getting-started/lessons/3-sensors-and-actuators/pi-actuator.md b/1-getting-started/lessons/3-sensors-and-actuators/pi-actuator.md index 8be038e5..adb8aec6 100644 --- a/1-getting-started/lessons/3-sensors-and-actuators/pi-actuator.md +++ b/1-getting-started/lessons/3-sensors-and-actuators/pi-actuator.md @@ -12,7 +12,7 @@ The nightlight logic in pseudo-code is: ```output Check the light level. -If the light is less than 200 +If the light is less than 300 Turn the LED on Otherwise Turn the LED off @@ -75,13 +75,13 @@ Program the nightlight. 1. Add a check inside the `while` loop, and before the `time.sleep` to check the light levels and turn the LED on or off: ```python - if light < 200: + if light < 300: led.on() else: led.off() ``` - This code checks the `light` value. If this is less than 200 it calls the `on` method of the `GroveLed` class which sends a digital value of 1 to the LED, turning it on. If the light value is greater than or equal to 200 it calls the `off` method, sending a digital value of 0 to the LED, turning it off. + This code checks the `light` value. If this is less than 300 it calls the `on` method of the `GroveLed` class which sends a digital value of 1 to the LED, turning it on. If the light value is greater than or equal to 300 it calls the `off` method, sending a digital value of 0 to the LED, turning it off. > 💁 This code should be indented to the same level as the `print('Light level:', light)` line to be inside the while loop! @@ -105,7 +105,7 @@ Program the nightlight. Light level: 290 ``` -1. Cover and uncover the sunlight sensor. Notice how the LED will light up if the light level is 200 or less, and turn off when the light level is greater than 200. +1. Cover and uncover the sunlight sensor. Notice how the LED will light up if the light level is 300 or less, and turn off when the light level is greater than 300. > 💁 If the LED doesn't turn on, make sure it is connected the right way round, and the spin button is set to full on. diff --git a/1-getting-started/lessons/3-sensors-and-actuators/pi-sensor.md b/1-getting-started/lessons/3-sensors-and-actuators/pi-sensor.md index d79dd99f..7c968115 100644 --- a/1-getting-started/lessons/3-sensors-and-actuators/pi-sensor.md +++ b/1-getting-started/lessons/3-sensors-and-actuators/pi-sensor.md @@ -75,7 +75,7 @@ Program the device. print('Light level:', light) ``` - This will read the current light level on a scale of 0-1,023 using the `ReadVisible` property of the `grove_si114x` class. This value is then printed to the console. + This will read the current sunlight level on a scale of 0-1,023 using the `ReadVisible` property of the `grove_si114x` class. This value is then printed to the console. 1. Add a small sleep of one second at the end of the `loop` as the light levels don't need to be checked continuously. A sleep reduces the power consumption of the device. diff --git a/1-getting-started/lessons/3-sensors-and-actuators/virtual-device-actuator.md b/1-getting-started/lessons/3-sensors-and-actuators/virtual-device-actuator.md index 403655f8..74895af1 100644 --- a/1-getting-started/lessons/3-sensors-and-actuators/virtual-device-actuator.md +++ b/1-getting-started/lessons/3-sensors-and-actuators/virtual-device-actuator.md @@ -12,17 +12,17 @@ The nightlight logic in pseudo-code is: ```output Check the light level. -If the light is less than 200 +If the light is less than 300 Turn the LED on Otherwise Turn the LED off ``` -### Add the sensors to CounterFit +### Add the actuator to CounterFit To use a virtual LED, you need to add it to the CounterFit app -#### Task +#### Task - add the actuator to CounterFit Add the LED to the CounterFit app. @@ -48,7 +48,7 @@ Add the LED to the CounterFit app. The nightlight can now be programmed using the CounterFit light sensor and LED. -#### Task +#### Task - program the nightlight Program the nightlight. @@ -75,13 +75,13 @@ Program the nightlight. 1. Add a check inside the `while` loop, and before the `time.sleep` to check the light levels and turn the LED on or off: ```python - if light < 200: + if light < 300: led.on() else: led.off() ``` - This code checks the `light` value. If this is less than 200 it calls the `on` method of the `GroveLed` class which sends a digital value of 1 to the LED, turning it on. If the light value is greater than or equal to 200 it calls the `off` method, sending a digital value of 0 to the LED, turning it off. + This code checks the `light` value. If this is less than 300 it calls the `on` method of the `GroveLed` class which sends a digital value of 1 to the LED, turning it on. If the light value is greater than or equal to 300 it calls the `off` method, sending a digital value of 0 to the LED, turning it off. > 💁 This code should be indented to the same level as the `print('Light level:', light)` line to be inside the while loop! @@ -101,7 +101,7 @@ Program the nightlight. Light level: 253 ``` -1. Change the *Value* or the *Random* settings to vary the light level above and below 200. You will see the LED turn on and off. +1. Change the *Value* or the *Random* settings to vary the light level above and below 300. You will see the LED turn on and off. ![The LED in the CounterFit app turning on and off as the light level changes](../../../images/virtual-device-running-assignment-1-1.gif) diff --git a/1-getting-started/lessons/3-sensors-and-actuators/virtual-device-sensor.md b/1-getting-started/lessons/3-sensors-and-actuators/virtual-device-sensor.md index 2f740bfe..e6d961de 100644 --- a/1-getting-started/lessons/3-sensors-and-actuators/virtual-device-sensor.md +++ b/1-getting-started/lessons/3-sensors-and-actuators/virtual-device-sensor.md @@ -12,7 +12,7 @@ The sensor is a **light sensor**. In a physical IoT device, it would be a [photo To use a virtual light sensor, you need to add it to the CounterFit app -#### Task +#### Task - add the sensors to CounterFit Add the light sensor to the CounterFit app. @@ -38,11 +38,10 @@ Add the light sensor to the CounterFit app. The device can now be programmed to use the built in light sensor. -### Task +### Task - program the light sensor Program the device. - 1. Open the nightlight project in VS Code that you created in the previous part of this assignment. Kill and re-create the terminal to ensure it is running using the virtual environment if necessary. 1. Open the `app.py` file diff --git a/1-getting-started/lessons/3-sensors-and-actuators/wio-terminal-actuator.md b/1-getting-started/lessons/3-sensors-and-actuators/wio-terminal-actuator.md index d4dfd1db..513bc9f4 100644 --- a/1-getting-started/lessons/3-sensors-and-actuators/wio-terminal-actuator.md +++ b/1-getting-started/lessons/3-sensors-and-actuators/wio-terminal-actuator.md @@ -12,7 +12,7 @@ The nightlight logic in pseudo-code is: ```output Check the light level. -If the light is less than 200 +If the light is less than 300 Turn the LED on Otherwise Turn the LED off @@ -22,7 +22,7 @@ Otherwise The Grove LED comes as a module with a selection of LEDs, allowing you to chose the color. -#### Task +#### Task - connect the LED Connect the LED. @@ -48,7 +48,7 @@ Connect the LED. The nightlight can now be programmed using the built in light sensor and the Grove LED. -### Task +### Task - program the nightlight Program the nightlight. @@ -67,7 +67,7 @@ Program the nightlight. 1. Add the following code immediately before the `delay` in the loop function: ```cpp - if (light < 200) + if (light < 300) { digitalWrite(D0, HIGH); } @@ -77,7 +77,7 @@ Program the nightlight. } ``` - This code checks the `light` value. If this is less than 200 it sends a `HIGH` value to the `D0` digital pin. This `HIGH` is a value of 1, turning on the LED. If the light is greater than or equal to 200, a `LOW` value of 0 is sent to the pin, turning the LED off. + This code checks the `light` value. If this is less than 300 it sends a `HIGH` value to the `D0` digital pin. This `HIGH` is a value of 1, turning on the LED. If the light is greater than or equal to 300, a `LOW` value of 0 is sent to the pin, turning the LED off. > 💁 When sending digital values to actuators, a LOW value is 0v, and a HIGH value is the max voltage for the device. For the Wio Terminal, the HIGH voltage is 3.3V. @@ -101,7 +101,7 @@ Program the nightlight. Light value: 344 ``` -1. Cover and uncover the light sensor. Notice how the LED will light up if the light level is 200 or less, and turn off when the light level is greater than 200. +1. Cover and uncover the light sensor. Notice how the LED will light up if the light level is 300 or less, and turn off when the light level is greater than 300. ![The LED connected to the WIO turning on and off as the light level changes](../../../images/wio-running-assignment-1-1.gif) diff --git a/1-getting-started/lessons/4-connect-internet/README.md b/1-getting-started/lessons/4-connect-internet/README.md index 80d9e811..89bcafb5 100644 --- a/1-getting-started/lessons/4-connect-internet/README.md +++ b/1-getting-started/lessons/4-connect-internet/README.md @@ -372,13 +372,13 @@ The next step for our Internet controlled nightlight is for the server code to s 1. Add the following code to the end of the `handle_telemetry` function: ```python - command = { 'led_on' : payload['light'] < 200 } + command = { 'led_on' : payload['light'] < 300 } print("Sending message:", command) client.publish(server_command_topic, json.dumps(command)) ``` - This sends a JSON message to the command topic with the value of `led_on` set to true or false depending on if the light is less than 200 or not. If the light is less than 200, true is sent to instruct the device to turn the LED on. + This sends a JSON message to the command topic with the value of `led_on` set to true or false depending on if the light is less than 300 or not. If the light is less than 300, true is sent to instruct the device to turn the LED on. 1. Run the code as before diff --git a/1-getting-started/lessons/4-connect-internet/code-commands/server/app.py b/1-getting-started/lessons/4-connect-internet/code-commands/server/app.py index 01b6a0f2..41097692 100644 --- a/1-getting-started/lessons/4-connect-internet/code-commands/server/app.py +++ b/1-getting-started/lessons/4-connect-internet/code-commands/server/app.py @@ -18,7 +18,7 @@ def handle_telemetry(client, userdata, message): payload = json.loads(message.payload.decode()) print("Message received:", payload) - command = { 'led_on' : payload['light'] < 200 } + command = { 'led_on' : payload['light'] < 300 } print("Sending message:", command) client.publish(server_command_topic, json.dumps(command)) diff --git a/1-getting-started/lessons/4-connect-internet/code-mqtt/pi/nightlight/app.py b/1-getting-started/lessons/4-connect-internet/code-mqtt/pi/nightlight/app.py index 5186de17..cadcd7ae 100644 --- a/1-getting-started/lessons/4-connect-internet/code-mqtt/pi/nightlight/app.py +++ b/1-getting-started/lessons/4-connect-internet/code-mqtt/pi/nightlight/app.py @@ -21,7 +21,7 @@ while True: light = light_sensor.light print('Light level:', light) - if light < 200: + if light < 300: led.on() else: led.off() diff --git a/1-getting-started/lessons/4-connect-internet/code-mqtt/virtual-device/nightlight/app.py b/1-getting-started/lessons/4-connect-internet/code-mqtt/virtual-device/nightlight/app.py index 6c68b5de..75dad840 100644 --- a/1-getting-started/lessons/4-connect-internet/code-mqtt/virtual-device/nightlight/app.py +++ b/1-getting-started/lessons/4-connect-internet/code-mqtt/virtual-device/nightlight/app.py @@ -24,7 +24,7 @@ while True: light = light_sensor.light print('Light level:', light) - if light < 200: + if light < 300: led.on() else: led.off()