Skip to content

Commit

Permalink
lesson 21 (microsoft#81)
Browse files Browse the repository at this point in the history
* Adding content

* Update en.json

* Update README.md

* Update TRANSLATIONS.md

* Adding lesson tempolates

* Fixing code files with each others code in

* Update README.md

* Adding lesson 16

* Adding virtual camera

* Adding Wio Terminal camera capture

* Adding wio terminal code

* Adding SBC classification to lesson 16

* Adding challenge, review and assignment

* Adding images and using new Azure icons

* Update README.md

* Update iot-reference-architecture.png

* Adding structure for JulyOT links

* Removing icons

* Sketchnotes!

* Create lesson-1.png

* Starting on lesson 18

* Updated sketch

* Adding virtual distance sensor

* Adding Wio Terminal image classification

* Update README.md

* Adding structure for project 6 and wio terminal distance sensor

* Adding some of the smart timer stuff

* Updating sketchnotes

* Adding virtual device speech to text

* Adding chapter 21
  • Loading branch information
Jim Bennett authored Jun 14, 2021
1 parent a648c9e commit 00502d7
Show file tree
Hide file tree
Showing 58 changed files with 1,517 additions and 42 deletions.
4 changes: 2 additions & 2 deletions 1-getting-started/lessons/2-deeper-dive/README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# A deeper dive into IoT

Add a sketchnote if possible/appropriate
![A sketchnote overview of this lesson](../../../sketchnotes/lesson-2.png)

![Embed a video here if available](video-url)
> Sketchnote by [Nitya Narasimhan](https://github.com/nitya). Click the image for a larger version.
## Pre-lecture quiz

Expand Down
2 changes: 1 addition & 1 deletion 2-farm/lessons/1-predict-plant-growth/assignment.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Once you have temperature data, you can use the Jupyter Notebook in this repo to
1. Install some pip packages for Jupyter notebooks, along with libraries needed to manage and plot the data:

```sh
pip install -U pip
pip install --upgrade pip
pip install pandas
pip install matplotlib
pip install jupyter
Expand Down
2 changes: 1 addition & 1 deletion 2-farm/lessons/4-migrate-your-plant-to-the-cloud/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ To use the Azure CLI, first it must be installed on your PC or Mac.
az account set --subscription <SubscriptionId>
```

Replace `<SubscriptionId>` with the Id of hte subscription you want to use. After running this command, re-run the command to list your accounts. You will see the `IsDefault` column will be marked as `True` for the subscription you have just set.
Replace `<SubscriptionId>` with the Id of the subscription you want to use. After running this command, re-run the command to list your accounts. You will see the `IsDefault` column will be marked as `True` for the subscription you have just set.

### Task - create a resource group

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@
import json
from azure.iot.device import IoTHubDeviceClient, Message, MethodResponse

connection_string = "<connection_string>"
connection_string = '<connection_string>'

adc = ADC()
relay = GroveRelay(5)

device_client = IoTHubDeviceClient.create_from_connection_string(connection_string)

print("Connecting")
print('Connecting')
device_client.connect()
print("Connected")
print('Connected')

def handle_method_request(request):
print("Direct method received - ", request.name)
Expand All @@ -32,7 +32,7 @@ def handle_method_request(request):
soil_moisture = adc.read(0)
print("Soil moisture:", soil_moisture)

message = Message(json.dumps({ "soil_moisture": soil_moisture }))
message = Message(json.dumps({ 'soil_moisture': soil_moisture }))
device_client.send_message(message)

time.sleep(10)
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@
import json
from azure.iot.device import IoTHubDeviceClient, Message, MethodResponse

connection_string = "<connection_string>"
connection_string = '<connection_string>'

adc = ADC()
relay = GroveRelay(5)

device_client = IoTHubDeviceClient.create_from_connection_string(connection_string)

print("Connecting")
print('Connecting')
device_client.connect()
print("Connected")
print('Connected')

def handle_method_request(request):
print("Direct method received - ", request.name)
Expand All @@ -35,7 +35,7 @@ def handle_method_request(request):
soil_moisture = adc.read(0)
print("Soil moisture:", soil_moisture)

message = Message(json.dumps({ "soil_moisture": soil_moisture }))
message = Message(json.dumps({ 'soil_moisture': soil_moisture }))
device_client.send_message(message)

time.sleep(10)
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@ The next step is to connect your device to IoT Hub.
```python
device_client = IoTHubDeviceClient.create_from_connection_string(connection_string)
print("Connecting")
print('Connecting')
device_client.connect()
print("Connected")
print('Connected')
```

1. Run this code. You will see your device connect.
Expand All @@ -66,7 +66,7 @@ Now that your device is connected, you can send telemetry to the IoT Hub instead
1. Add the following code inside the `while True` loop, just before the sleep:

```python
message = Message(json.dumps({ "soil_moisture": soil_moisture }))
message = Message(json.dumps({ 'soil_moisture': soil_moisture }))
device_client.send_message(message)
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@

device_client = IoTHubDeviceClient.create_from_x509_certificate(x509, host_name, device_id)

print("Connecting")
print('Connecting')
device_client.connect()
print("Connected")
print('Connected')

def handle_method_request(request):
print("Direct method received - ", request.name)
Expand All @@ -34,7 +34,7 @@ def handle_method_request(request):
soil_moisture = adc.read(0)
print("Soil moisture:", soil_moisture)

message = Message(json.dumps({ "soil_moisture": soil_moisture }))
message = Message(json.dumps({ 'soil_moisture': soil_moisture }))
device_client.send_message(message)

time.sleep(10)
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@

device_client = IoTHubDeviceClient.create_from_x509_certificate(x509, host_name, device_id)

print("Connecting")
print('Connecting')
device_client.connect()
print("Connected")
print('Connected')

def handle_method_request(request):
print("Direct method received - ", request.name)
Expand All @@ -37,7 +37,7 @@ def handle_method_request(request):
soil_moisture = adc.read(0)
print("Soil moisture:", soil_moisture)

message = Message(json.dumps({ "soil_moisture": soil_moisture }))
message = Message(json.dumps({ 'soil_moisture': soil_moisture }))
device_client.send_message(message)

time.sleep(10)
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,17 @@
import json
from azure.iot.device import IoTHubDeviceClient, Message

connection_string = "<connection_string>"
connection_string = '<connection_string>'

serial = serial.Serial('/dev/ttyAMA0', 9600, timeout=1)
serial.reset_input_buffer()
serial.flush()

device_client = IoTHubDeviceClient.create_from_connection_string(connection_string)

print("Connecting")
print('Connecting')
device_client.connect()
print("Connected")
print('Connected')

def printGPSData(line):
msg = pynmea2.parse(line)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@
import json
from azure.iot.device import IoTHubDeviceClient, Message

connection_string = "<connection_string>"
connection_string = '<connection_string>'

serial = counterfit_shims_serial.Serial('/dev/ttyAMA0')

device_client = IoTHubDeviceClient.create_from_connection_string(connection_string)

print("Connecting")
print('Connecting')
device_client.connect()
print("Connected")
print('Connected')

def send_gps_data(line):
msg = pynmea2.parse(line)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@
import json
from azure.iot.device import IoTHubDeviceClient, Message, MethodResponse

connection_string = "<connection_string>"
connection_string = '<connection_string>'

adc = ADC()
relay = GroveRelay(5)

device_client = IoTHubDeviceClient.create_from_connection_string(connection_string)

print("Connecting")
print('Connecting')
device_client.connect()
print("Connected")
print('Connected')

def handle_method_request(request):
print("Direct method received - ", request.name)
Expand All @@ -32,7 +32,7 @@ def handle_method_request(request):
soil_moisture = adc.read(0)
print("Soil moisture:", soil_moisture)

message = Message(json.dumps({ "soil_moisture": soil_moisture }))
message = Message(json.dumps({ 'soil_moisture': soil_moisture }))
device_client.send_message(message)

time.sleep(10)
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@
import json
from azure.iot.device import IoTHubDeviceClient, Message, MethodResponse

connection_string = "<connection_string>"
connection_string = '<connection_string>'

adc = ADC()
relay = GroveRelay(5)

device_client = IoTHubDeviceClient.create_from_connection_string(connection_string)

print("Connecting")
print('Connecting')
device_client.connect()
print("Connected")
print('Connected')

def handle_method_request(request):
print("Direct method received - ", request.name)
Expand All @@ -35,7 +35,7 @@ def handle_method_request(request):
soil_moisture = adc.read(0)
print("Soil moisture:", soil_moisture)

message = Message(json.dumps({ "soil_moisture": soil_moisture }))
message = Message(json.dumps({ 'soil_moisture': soil_moisture }))
device_client.send_message(message)

time.sleep(10)
4 changes: 4 additions & 0 deletions 4-manufacturing/lessons/4-trigger-fruit-detector/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ In this lesson we'll cover:
* [Using developer devices to simulate multiple IoT devices](#using-developer-devices-to-simulate-multiple-iot-devices)
* [Moving to production](#moving-to-production)

> 🗑 This is the last lesson in this project, so after completing this lesson and the assignment, don't forget to clean up your cloud services. You will need the services to complete the assignment, so make sure to complete that first.
>
> Refer to [the clean up your project guide](../../../clean-up.md) if necessary for instructions on how to do this.
## Architect complex IoT applications

IoT applications are made up of many components. This includes a variety of things, and a variety of internet services.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.pio
.vscode/.browse.c_cpp.db*
.vscode/c_cpp_properties.json
.vscode/launch.json
.vscode/ipch
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
// See http://go.microsoft.com/fwlink/?LinkId=827846
// for the documentation about the extensions.json format
"recommendations": [
"platformio.platformio-ide"
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@

This directory is intended for project header files.

A header file is a file containing C declarations and macro definitions
to be shared between several project source files. You request the use of a
header file in your project source file (C, C++, etc) located in `src` folder
by including it, with the C preprocessing directive `#include'.

```src/main.c

#include "header.h"

int main (void)
{
...
}
```

Including a header file produces the same results as copying the header file
into each source file that needs it. Such copying would be time-consuming
and error-prone. With a header file, the related declarations appear
in only one place. If they need to be changed, they can be changed in one
place, and programs that include the header file will automatically use the
new version when next recompiled. The header file eliminates the labor of
finding and changing all the copies as well as the risk that a failure to
find one copy will result in inconsistencies within a program.

In C, the usual convention is to give header files names that end with `.h'.
It is most portable to use only letters, digits, dashes, and underscores in
header file names, and at most one dot.

Read more about using header files in official GCC documentation:

* Include Syntax
* Include Operation
* Once-Only Headers
* Computed Includes

https://gcc.gnu.org/onlinedocs/cpp/Header-Files.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@

This directory is intended for project specific (private) libraries.
PlatformIO will compile them to static libraries and link into executable file.

The source code of each library should be placed in a an own separate directory
("lib/your_library_name/[here are source files]").

For example, see a structure of the following two libraries `Foo` and `Bar`:

|--lib
| |
| |--Bar
| | |--docs
| | |--examples
| | |--src
| | |- Bar.c
| | |- Bar.h
| | |- library.json (optional, custom build options, etc) https://docs.platformio.org/page/librarymanager/config.html
| |
| |--Foo
| | |- Foo.c
| | |- Foo.h
| |
| |- README --> THIS FILE
|
|- platformio.ini
|--src
|- main.c

and a contents of `src/main.c`:
```
#include <Foo.h>
#include <Bar.h>

int main (void)
{
...
}

```

PlatformIO Library Dependency Finder will find automatically dependent
libraries scanning project source files.

More information about PlatformIO Library Dependency Finder
- https://docs.platformio.org/page/librarymanager/ldf.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
; PlatformIO Project Configuration File
;
; Build options: build flags, source filter
; Upload options: custom upload port, speed and extra flags
; Library options: dependencies, extra library storages
; Advanced options: extra scripting
;
; Please visit documentation for the other options and examples
; https://docs.platformio.org/page/projectconf.html

[env:seeed_wio_terminal]
platform = atmelsam
board = seeed_wio_terminal
framework = arduino
lib_deps =
seeed-studio/Grove Ranging sensor - VL53L0X @ ^1.1.1
Loading

0 comments on commit 00502d7

Please sign in to comment.