From 5adefbc97e38a205db48dfccc24c88cce4b50f65 Mon Sep 17 00:00:00 2001 From: Jim Bennett Date: Tue, 1 Jun 2021 17:38:04 -0700 Subject: [PATCH 1/3] FIxing code files (#48) * Adding content * Update en.json * Update README.md * Update TRANSLATIONS.md * Adding lesson tempolates * Fixing code files with each others code in --- 1-getting-started/lessons/4-connect-internet/README.md | 2 ++ .../4-connect-internet/code-commands/server/app.py | 8 +++++++- .../lessons/4-connect-internet/code-server/server/app.py | 8 +------- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/1-getting-started/lessons/4-connect-internet/README.md b/1-getting-started/lessons/4-connect-internet/README.md index e5e61322..b6cd3e68 100644 --- a/1-getting-started/lessons/4-connect-internet/README.md +++ b/1-getting-started/lessons/4-connect-internet/README.md @@ -392,6 +392,8 @@ The next step for our Internet controlled nightlight is for the server code to s > 💁 The telemetry and commands are being sent on a single topic each. This means telemetry from multiple devices will appear on the same telemetry topic, and commands to multiple devices will appear on the same commands topic. If you wanted to send a command to a specific device, you could use multiple topics, named with a unique device id, such as `/commands/device1`, `/commands/device2`. That way a device can listen on messages just meant for that one device. +> 💁 You can find this code in the [code-commands/server](code-commands/server) folder. + ### Handle commands on the IoT device Now that commands are being sent from the server, you cna now add code to the IoT device to handle them and control the LED. 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 e6b46379..01b6a0f2 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 @@ -6,7 +6,8 @@ import paho.mqtt.client as mqtt id = '' client_telemetry_topic = id + '/telemetry' -client_name = id + '_nightlight_server' +server_command_topic = id + '/commands' +client_name = id + 'nightlight_server' mqtt_client = mqtt.Client(client_name) mqtt_client.connect('test.mosquitto.org') @@ -17,6 +18,11 @@ def handle_telemetry(client, userdata, message): payload = json.loads(message.payload.decode()) print("Message received:", payload) + command = { 'led_on' : payload['light'] < 200 } + print("Sending message:", command) + + client.publish(server_command_topic, json.dumps(command)) + mqtt_client.subscribe(client_telemetry_topic) mqtt_client.on_message = handle_telemetry diff --git a/1-getting-started/lessons/4-connect-internet/code-server/server/app.py b/1-getting-started/lessons/4-connect-internet/code-server/server/app.py index 01b6a0f2..e6b46379 100644 --- a/1-getting-started/lessons/4-connect-internet/code-server/server/app.py +++ b/1-getting-started/lessons/4-connect-internet/code-server/server/app.py @@ -6,8 +6,7 @@ import paho.mqtt.client as mqtt id = '' client_telemetry_topic = id + '/telemetry' -server_command_topic = id + '/commands' -client_name = id + 'nightlight_server' +client_name = id + '_nightlight_server' mqtt_client = mqtt.Client(client_name) mqtt_client.connect('test.mosquitto.org') @@ -18,11 +17,6 @@ def handle_telemetry(client, userdata, message): payload = json.loads(message.payload.decode()) print("Message received:", payload) - command = { 'led_on' : payload['light'] < 200 } - print("Sending message:", command) - - client.publish(server_command_topic, json.dumps(command)) - mqtt_client.subscribe(client_telemetry_topic) mqtt_client.on_message = handle_telemetry From 84e9269ea6f207eb1319d135fe74512fb3dd90fc Mon Sep 17 00:00:00 2001 From: Sambek99 <51484261+Sambek99@users.noreply.github.com> Date: Tue, 1 Jun 2021 19:45:21 -0500 Subject: [PATCH 2/3] Lesson templates translations (#39) * Create README.es.md * Update README.es.md * Update README.es.md Spanish translation * Update README.es.md Spanish translation * Update README.es.md Spanish translation * Create assignment.es.md Spanish translation Co-authored-by: Jim Bennett --- lesson-template/translations/README.es.md | 51 +++++++++++++++++++ lesson-template/translations/assignment.es.md | 9 ++++ 2 files changed, 60 insertions(+) create mode 100644 lesson-template/translations/README.es.md create mode 100644 lesson-template/translations/assignment.es.md diff --git a/lesson-template/translations/README.es.md b/lesson-template/translations/README.es.md new file mode 100644 index 00000000..d322e9fd --- /dev/null +++ b/lesson-template/translations/README.es.md @@ -0,0 +1,51 @@ +# [Tema de la lección] + +![Embeba un video aquí](video-url) + +## [Quiz pre-sesión](quiz-url) + +[Describa qué aprenderemos] + +### Introducción + +Describa qué cubriremos + +> Notas + +### Prerrequisitos + +¿Qué temas deberían haberse cubierto antes de esta lección? + +### Preparación + +Pasos preliminares para empezar esta lección + +--- + +[Organice su contenido en bloques] + +## [Tema 1] + +### Tarea: + +Trabaje en equipo para perfeccionar progresivamente su base de código para construir el proyecto con código compartido: + +```html +bloques de código +``` + +✅ Prueba de conocimiento - use este momento para desafiar el conocimiento de sus estudiantes con preguntas abiertas + +## [Tema 2] + +## [Tema 3] + +🚀 Reto: Proponga un reto para que los estudiantes trabajen colaborativamente en clase para perfeccionar el proyecto + +Opcional: Si se requiere, agregue una captura de pantalla del UI de la lección completa + +## [Quiz post-sesión](quiz-url) + +## Revisión & Aprendizaje autónomo + +**FECHA DE ENTREGA [MM/AA]**: [Nombre de la tarea](tarea.md) diff --git a/lesson-template/translations/assignment.es.md b/lesson-template/translations/assignment.es.md new file mode 100644 index 00000000..5d25b122 --- /dev/null +++ b/lesson-template/translations/assignment.es.md @@ -0,0 +1,9 @@ +# [Nombre de la tarea] + +## Instrucciones + +## Rúbrica + +| Criterios| Excelente | Adecuado | Puede mejorar | +| -------- | --------- | -------- | ----------------- | +| | | | | From f4d6dce82f3ed39e8fa6012c0829d33a2560d210 Mon Sep 17 00:00:00 2001 From: Priyanshu Srivastav <74033507+priyanshu870@users.noreply.github.com> Date: Wed, 2 Jun 2021 06:25:45 +0530 Subject: [PATCH 3/3] Fixed some spelling and grammatical mistakes (#41) * corrected a grammatical mistakes * Corrected grammatical mistakes Co-authored-by: Jim Bennett --- 3-transport/lessons/1-location-tracking/README.md | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/3-transport/lessons/1-location-tracking/README.md b/3-transport/lessons/1-location-tracking/README.md index 05ebab64..2bb82fb8 100644 --- a/3-transport/lessons/1-location-tracking/README.md +++ b/3-transport/lessons/1-location-tracking/README.md @@ -10,7 +10,7 @@ Add a sketchnote if possible/appropriate ## Introduction -The main process for getting food from a farmer to a consumer involves loading boxes of produce on to trucks, ships, airplanes or other commercial transport vehicles, and delivering the food somewhere - either direct to a customer, or to a central hub or warehouse for processing. The whole end-to-end process from farm to consumer is part of a process called the *supply chain*. The video below from Arizona State University's W. P. Carey School of Business talks about the idea of the supply chain and how it is managed in more detail. +The main process for getting food from a farmer to a consumer involves loading boxes of produce on to trucks, ships, airplanes, or other commercial transport vehicles, and delivering the food somewhere - either direct to a customer, or to a central hub or warehouse for processing. The whole end-to-end process from farm to consumer is part of a process called the *supply chain*. The video below from Arizona State University's W. P. Carey School of Business talks about the idea of the supply chain and how it is managed in more detail. [![What is Supply Chain Management? A video from Arizona State University's W. P. Carey School of Business](https://img.youtube.com/vi/Mi1QBxVjZAw/0.jpg)](https://www.youtube.com/watch?v=Mi1QBxVjZAw) @@ -45,7 +45,7 @@ IoT is transforming the way goods are transported by creating fleets of *connect * Driver hours compliance - ensuring drivers only drive for their legally allowed hours based on the times they turn the engine on and off. -These benefits can be combined - for example, combining driver hours compliance with location tracking to re-route drivers if they cannot reach their destination within their allowed driving hours. These can also be combined with other vehicle-specific telemetry, such as temperature data from temperature controlled trucks, allow vehicles to be re-routed if their current route would mean goods cannot be kept at temperature. +These benefits can be combined - for example, combining driver hours compliance with location tracking to re-route drivers if they cannot reach their destination within their allowed driving hours. These can also be combined with other vehicle-specific telemetry, such as temperature data from temperature-controlled trucks, allow vehicles to be re-routed if their current route would mean goods cannot be kept at temperature. > 🎓 Logistics is the process of transporting goods from one place to another, such as from a farm to a supermarket via one or more warehouses. A farmer packs boxes of tomatoes that are loaded onto a truck, delivered to a central warehouse, and put onto a second truck that may contain a mixture of different types of produce which are then delivered to a supermarket. @@ -81,7 +81,7 @@ To measure the longitude of a point, you measure the number of degrees round the Traditionally, measurements of degrees of latitude and longitude were done using sexagesimal numbering, or base-60, a numbering system used by the Ancient Babylonians who did the first measurements and recordings of time and distance. You use sexagesimal every day probably without even realising it - dividing hours into 60 minutes and minutes into 60 seconds. -Longitude and latitude is measured in degrees, minutes and seconds, with one minute being 1/60 of a degree, and 1 second being 1/60 minute. +Longitude and latitude are measured in degrees, minutes and seconds, with one minute being 1/60 of a degree, and 1 second being 1/60 minute. For example, at the equator: @@ -89,11 +89,11 @@ For example, at the equator: * 1 minute of latitude is 111.3/60 = **1.855 kilometers** * 1 second of latitude is 1.855/60 = **0.031 kilometers** -The symbol for a minute is a single quote, for a second it is a double quote. 2 degrees, 17 minutes and 43 seconds for example, would be written as 2°17'43". Parts of seconds are given as decimals, for example half a second is 0°0'0.5". +The symbol for a minute is a single quote, for a second it is a double quote. 2 degrees, 17 minutes, and 43 seconds for example, would be written as 2°17'43". Parts of seconds are given as decimals, for example half a second is 0°0'0.5". Computers don't work in base-60, so these coordinates are given as decimal degrees when using GPS data in most computer systems. For example, 2°17'43" is 2.295277. The degree symbol is usually omitted. -Coordinates for a point are always given as `latitude,longitude`, so the example earlier of the Microsoft Campus at 47.6423109,-122.117198 has: +Coordinates for a point are always given as `latitude, longitude`, so the example earlier of the Microsoft Campus at 47.6423109,-122.117198 has: * A latitude of 47.6423109 (47.6423109 degrees north of the equator) * A longitude of -122.1390293 (122.1390293 degrees west of the Prime Meridian). @@ -152,7 +152,7 @@ GPS sensors output data using NMEA messages, using the NMEA 0183 standard. NMEA These messages are text-based. Each message consists of a *sentence* that starts with a `$` character, followed by 2 characters to indicate the source of the message (e.g GP for the US GPS system, GN for GLONASS, the Russian GPS system), and 3 characters to indicate the type of message. The rest of the message is fields separated by commas, ending in a new line character. -Some of the types of message that can be received are: +Some of the types of messages that can be received are: | Type | Description | | ---- | ----------- | @@ -164,7 +164,7 @@ Some of the types of message that can be received are: The GGA message includes the current location using the `(dd)dmm.mmmm` format, along with a single character to indicate direction. The `d` in the format is degrees, the `m` is minutes, with seconds as decimals of minutes. For example, 2°17'43" would be 217.716666667 - 2 degrees, 17.716666667 minutes. -The direction character can be `N` or `S` for latitude to indicate north or south, and `E` or `W` for longitude to indicate east or west. For example, a latitude of 2°17'43" would have a direction character of `N`, -2°17'43" would have a direction character of `S`. +The direction character can be `N` or `S` for latitude to indicate north or south, and `E` or `W` for longitude to indicate east or west. For example, a latitude of 2°17'43" would have a direction character of `N`, -2°17'43" would have a direction character of `S`. For example - the NMEA sentence `$GNGGA,020604.001,4738.538654,N,12208.341758,W,1,3,,164.7,M,-17.1,M,,*67`