Skip to content

Commit b16a7c6

Browse files
committed
Merge branch 'main' into jacobhylen/uno-ds
2 parents fdb05e6 + f6af638 commit b16a7c6

File tree

21 files changed

+84
-39
lines changed

21 files changed

+84
-39
lines changed

content/learn/02.microcontrollers/01.digital-pins/digital-pins.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ The pins on the Arduino can be configured as either inputs or outputs. This doc
88

99
## Properties of Pins Configured as INPUT
1010

11-
Arduino (Atmega) pins default to inputs, so they don't need to be explicitly declared as inputs with pinMode() when you're using them as inputs. Pins configured this way are said to be in a **high-impedance state**. Input pins make extremely small demands on the circuit that they are sampling, equivalent to a series resistor of 100 megohm in front of the pin. This means that it takes very little current to move the input pin from one state to another, and can make the pins useful for such tasks as implementing [a capacitive touch sensor](https://playground.arduino.cc/Code/CapacitiveSensor), reading an LED as a [photodiode](https://playground.arduino.cc/Learning/LEDSensor), or reading an analog sensor with a scheme such as [RCTime.](https://arduino.cc/en/Tutorial/RCtime)
11+
Arduino (Atmega) pins default to inputs, so they don't need to be explicitly declared as inputs with pinMode() when you're using them as inputs. Pins configured this way are said to be in a **high-impedance state**. Input pins make extremely small demands on the circuit that they are sampling, equivalent to a series resistor of 100 megohm in front of the pin. This means that it takes very little current to move the input pin from one state to another, and can make the pins useful for such tasks as implementing [a capacitive touch sensor](https://playground.arduino.cc/Code/CapacitiveSensor), reading an LED as a [photodiode](https://playground.arduino.cc/Learning/LEDSensor), or reading an analog sensor with a scheme such as [RCTime](/tutorials/generic/capacitance-meter).
1212

1313
This also means however, that pins configured as pinMode(pin, INPUT) with nothing connected to them, or with wires connected to them that are not connected to other circuits, will report seemingly random changes in pin state, picking up electrical noise from the environment, or capacitively coupling the state of a nearby pin.
1414

content/micropython-course/course/00.introduction-arduino/intro-to-arduino.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
featured: micropython-101
3-
title: 'Introduction to Arduino'
3+
title: '1. Introduction to Arduino'
44
description: 'Learn about the Arduino platform'
55
author: 'Karl Söderby'
66
hero_image: "./hero-banner.png"

content/micropython-course/course/01.introduction-python/02.intro-to-micropython.md

Lines changed: 43 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ author: 'Karl Söderby'
33
hero_image: "./hero-banner.png"
44
micropython_type: "101"
55
featured: micropython-101
6-
title: 'Introduction to MicroPython'
6+
title: '2. Introduction to MicroPython'
77
description: 'Learn about the Arduino platform'
88
---
99

@@ -146,39 +146,67 @@ For example, to use a module for a specific sensor, we need to install it **exte
146146

147147
### Install External Modules
148148

149-
To install an external module, we are going to use something called `mip`. With `mip`, we can install a module on the board directly, by connecting to Wi-Fi and downloading the module directly to the board. So how do we do this?
149+
To install an external module, we are going to use a package manager called `mip`. With `mip`, we can install a module on the board by connecting to Wi-Fi® and downloading the module directly to the board. Installing external modules is done in two steps:
150150

151-
Below is a script that first connects to Wi-Fi®, and then downloads a specific module. In this case, we will provide a URL to a file stored on GitHub (the raw file). In this case, we will install the `lis3dh` module, which will be used later on in this course.
151+
1. Establish a Wi-Fi connection.
152152

153-
Please note that you need to add your own Wi-Fi® network and password in the `WIFI_NETWORK` and `WIFI_PASSWORD` fields.
153+
2. Download the module from a specific URL using `mip`.
154+
155+
To connect to your local Wi-Fi you can upload the following script to `boot.py` file. We choose `boot.py` because we want to make sure our board connects to the internet as soon as it boots up.
156+
157+
**Connect to Wi-Fi**
158+
159+
![Wi-Fi script inside boot.py](./assets/boot.png)
160+
161+
***Please note that you need to add your own Wi-Fi network and password in the `WIFI_NETWORK` and `WIFI_PASSWORD` fields.***
154162

155163
```python
156164
"""
157-
This script first connects to Wi-Fi,
158-
then installs the module specified
159-
in the URL variable.
165+
This script connects to Wi-Fi
160166
"""
161167

162168
import network
163-
import mip
164169

165170
WIFI_NETWORK='YOUR_NETWORK_NAME'
166171
WIFI_PASSWORD='YOUR_NETWORK_PASSWORD'
167172

168-
# add the URL of the module you want to install
169-
URL = "https://raw.githubusercontent.com/tinypico/tinypico-micropython/master/lis3dh%20library/lis3dh.py"
170-
171173
wlan = network.WLAN(network.STA_IF)
172174
wlan.active(True)
173175
wlan.connect(WIFI_NETWORK, WIFI_PASSWORD)
174176

175177
print()
176178
print("Connected to ",WIFI_NETWORK)
179+
```
180+
Press run and you should see `Connected to <your Wi-Fi>` being printed inside the REPL.
181+
182+
![Successful connection](./assets/wifiConnected.png)
183+
184+
**Install external modules**
185+
186+
Next, you need to run a script that installs the external module from a specific URL. Upload the following script to `main.py`.
177187

178-
mip.install(URL)
188+
![Module installation script inside main.py](./assets/main.png)
189+
190+
```python
191+
'''
192+
This script installs external modules using mip
193+
'''
194+
195+
import mip
196+
mip.install("https://raw.githubusercontent.com/tinypico/tinypico-micropython/master/lis3dh%20library/lis3dh.py")
179197
```
180198

181-
Once you run the script successfully, you will have installed the module on your board.
199+
Press run and you should see the following inside the REPL:
200+
201+
![Successful download](./assets/download.png)
202+
203+
In this case, we will provide a URL to a file stored on GitHub (the raw file). The script installs the `lis3dh` module, which will be used later on in this course.
204+
205+
You can verify that the module was installed correctly by pressing `Files` and checking inside the `lib` folder. You should see a file called `lis3dh.py` inside.
206+
207+
![Installed module](./assets/libFolderIn.png)
208+
209+
When asked later in the course to install external modules simply paste the provided script into `main.py` and press run.
182210

183211
### Removing Modules
184212

@@ -215,9 +243,9 @@ OSError: -202
215243

216244
Some things to check are:
217245
- Did you enter your network credentials properly?
218-
- Did you already connect to Wi-Fi®?
246+
- Did you already connect to Wi-Fi?
219247

220-
If the error persist, you can try to "soft-reset" the board, by clicking the **"Reset"** button, and run the script again.
248+
If the error persists, you can try to "soft-reset" the board, by clicking the **"Reset"** button, and run the script again.
221249

222250
![](assets/reset.png)
223251

136 KB
Loading
142 KB
Loading
103 KB
Loading
104 KB
Loading
157 KB
Loading
Binary file not shown.

content/micropython-course/course/02.installation/installation-tools.md

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ author: 'Jacob Hylen'
33
hero_image: "./hero-banner.png"
44
micropython_type: "101"
55
featured: micropython-101
6-
title: 'MicroPython Installation Guide'
6+
title: '3. MicroPython Installation Guide'
77
description: 'Learn how to install a code editor needed to program your board with MicroPython.'
88
---
99

@@ -33,15 +33,7 @@ First, [download the app here](https://labs.arduino.cc/en/labs/micropython). It
3333

3434
If you're on macOS, move the application to your **Applications** folder.
3535

36-
**2. Put the Board in Bootloader Mode**
37-
38-
Before we can install MicroPython, we need to place our board in a "bootloader" mode as we call it. This will make it possible to send a new firmware to it.
39-
40-
Connect your board to your computer, and connect B1 to GND with a jumper wire, tweezers, or something else metallic you have handy. Once you see a green light on the board, press the reset button on the board. If you remove the connection between B1 and GND, you should see a dim purple light if this step was successful. If not, then try again.
41-
42-
![Bootloader Mode](./assets/bootloader.png)
43-
44-
**3. Download the Firmware Installer**
36+
**2. Download the Firmware Installer**
4537

4638
The **Firmware Installer** program will help install MicroPython on your board.
4739

@@ -51,21 +43,21 @@ First [download the app here](), and extract the files to a folder on your compu
5143

5244
If you're on macOS, move the application to your **Applications** folder.
5345

54-
**4. Flash Firmware**
46+
**3. Flash Firmware**
5547

5648
Now open the Firmware Installer tool, select the Arduino Nano ESP32, and press **"Install MicroPython"**. Wait for the installer to do its magic and after some seconds, we are ready to go!
5749

5850
![Installer with Board Selected](./assets/installer.png)
5951

6052
If the installer doesn't find the MicroPython firmware automatically, you can download it manually from [here](./assets/nanoesp32_micropython.bin)
6153

62-
**5. Connect your Code Editor and Board**
54+
**4. Connect your Code Editor and Board**
6355

6456
In the Arduino Lab for MicroPython app, press **connect** in the top left corner and choose the serial port that comes up. This is your Nano ESP32.
6557

6658
![Connect to your Board](./assets/connect.png)
6759

68-
**6. Verify**
60+
**5. Verify**
6961

7062
Now, to verify things are working as they should, copy the script script below into your `main.py` file, and run it by clicking the **"Run"** button.
7163

0 commit comments

Comments
 (0)