Skip to content

Commit e09cd2c

Browse files
authored
Merge pull request #2293 from arduino/karlsoderby/graphics-update
[PXCT-204]
2 parents 6e14a2f + 40e03e3 commit e09cd2c

36 files changed

+38
-65
lines changed

content/micropython/03.micropython/00.first-steps/00.into-micropython/intro-micropython.md renamed to content/micropython/03.micropython/00.first-steps/00.intro-micropython/intro-micropython.md

+3-7
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ MicroPython is a lightweight implementation of Python 3 designed to run on micro
1010

1111
## MicroPython on Arduino Boards
1212

13-
![Placeholder graphic]()
13+
![MicroPython with Arduino](assets/micropython-arduino.png)
1414

1515
When using MicroPython on Arduino boards, the software is first installed on your Arduino. This allows the board to interpret and run Python code. Once MicroPython is installed on your board (don't worry, we'll cover this [here]()), you can start writing and executing Python scripts instantly.
1616

@@ -20,7 +20,7 @@ Unlike traditional development approaches, where you compile code and then flash
2020

2121
Once MicroPython is installed, you can start programming by writing scripts and uploading them to the board. These scripts are interpreted in real-time, meaning you can make quick changes and see immediate results, streamlining the development process.
2222

23-
![TODO: Image of code edit with immediate change]()
23+
![Running a script.](assets/run-script.gif)
2424

2525
MicroPython also includes a simple file system where your scripts are stored. For example, when you write a script, it is saved directly on the board and can be executed immediately without compiling. You can also save other scripts that can be activated from the main script!
2626

@@ -36,8 +36,6 @@ The MicroPython installation includes several key components:
3636

3737
2. **Base Modules**: MicroPython comes with built-in modules for working with hardware like pins, sensors, and communication protocols (I2C, SPI, etc.). This includes essential modules like `machine`, `network`, and `time`.
3838

39-
![TODO: A diagram showing how `boot.py` and `main.py` are loaded during the boot process and how they fit into the file system could be useful here.]()
40-
4139
## How to Program for MicroPython
4240

4341
Programming in MicroPython involves writing Python scripts in a text editor and then running them on your board. For this, we can use the [Arduino Lab for MicroPython]().
@@ -50,8 +48,6 @@ When writing MicroPython code, it's essential to think in terms of **modularity*
5048
2. **Helper Modules**: Break down your code into smaller modules for specific tasks, such as controlling a sensor or managing a display. These modules can be imported into `main.py` as needed.
5149
3. **Interrupts and Background Tasks**: If you're dealing with hardware, you may also need to work with interrupts or periodic tasks, which can be handled in dedicated modules.
5250

53-
![TODO: A flowchart here could be beneficial to illustrate how to structure a MicroPython project, with `main.py` at the top and helper modules branching off.]()
54-
5551
## MicroPython vs. C++ for Electronics Projects
5652

5753
MicroPython offers a different approach to programming compared to the traditional C++ used in Arduino development. Here are a few key comparisons:
@@ -60,6 +56,6 @@ MicroPython offers a different approach to programming compared to the tradition
6056
- **Real-Time Interactivity**: With MicroPython, you can write and test code interactively, without needing to compile. This makes it faster to experiment and troubleshoot hardware setups.
6157
- **Resource Efficiency**: C++ is more efficient in terms of memory and speed, making it a better option for projects that need to squeeze every bit of performance out of the hardware. MicroPython, on the other hand, prioritizes ease of development over raw performance, but it is still capable of handling many common hardware tasks.
6258

63-
![TODO: A side-by-side table comparing typical tasks (like reading a sensor or blinking an LED) in MicroPython and C++ could help illustrate the differences.]()
59+
## Summary
6460

6561
In summary, MicroPython provides a powerful and flexible way to develop electronic projects, especially for those familiar with Python. Its ability to run on microcontrollers like Arduino boards makes it an attractive option for both beginners and experienced developers who want a fast and efficient workflow.
Loading
Loading
Loading

content/micropython/03.micropython/00.first-steps/01.install-guide/installing-micropython.md

+11-19
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,11 @@ MicroPython is officially supported on several Arduino boards. Here’s a list o
4747

4848
1. First, download the [Micropython Firmware Installer](https://labs.arduino.cc/en/labs/micropython-installer) and launch it.
4949
2. Connect your board to your computer, it should be recognized by the installer.
50-
![Arduino Nano ESP32 detected!](./assets/board-selected.png)
50+
![Arduino Nano ESP32 detected!](./assets/select-board.png)
5151
3. Press **INSTALL MICROPYTHON**. A loading animation will appear.
5252

5353
Once the firmware is installed a "Installation successful" message will appear. At this point you can safely close the installer as your board is now ready for tinkering!
54-
![Firmware Successfully Uploaded!](./assets/flashed.png)
54+
![Firmware Successfully Uploaded!](./assets/installation-success.png)
5555

5656
## Editor Setup
5757

@@ -63,20 +63,16 @@ First, download the latest version of [Arduino Lab for MicroPython](https://labs
6363

6464
#### MacOS
6565

66-
Run the downloaded file, and move it to your **"Applications"** folder.
67-
68-
![Installation MacOS.]()
66+
Unzip the downloaded file, and run the application.
6967

7068
#### Windows
7169

7270
Unzip the downloaded file, and run the executable file (`.exe`).
7371

74-
![Installation Windows]()
75-
7672
### Online Setup
7773

7874
Alternatively, we can use the IDE without the need of installing anything. Simply visit the link below:
79-
- [Arduino Lab for MicroPython (online).](https://lab-micropython.arduino.cc/).
75+
- [Arduino Lab for MicroPython (online)](https://lab-micropython.arduino.cc/).
8076

8177
## Connecting Board and IDE
8278

@@ -87,24 +83,20 @@ At this point in the tutorial, we have
8783
We will now try out running a script on the board, to make sure things are working properly.
8884

8985
1. Plug the Arduino board into the computer using a USB cable.
90-
![Connect board to computer.]()
91-
2. Press the connection button on the top left corner of the window.
92-
![Connect the editor to the board.]()
93-
3. The connected Arduino board should appear, and we can click it:
94-
![Select board.]()
86+
![Connect board to computer.](assets/usb-comp.png)
87+
2. Press the connection button on the top left corner of the window. The connected Arduino board should appear (by its port name), and we can click it:
88+
![Connect to the board in the editor.](assets/select-board-ide.png)
9589

9690
We have now set up all necessary steps for running a script!
9791

9892
## Running a Test Script
9993

10094
With the installation and setup complete, let's try out running a very simple script: **Hello World!**
10195

102-
1. In the text area field of the editor, write the following: `print("Hello World!")`
103-
![Write hello world.]()
104-
2. Click on the play symbol (RUN).
105-
![Run the script.]()
106-
3. After running it, you should see `Hello World!` in the black box. This is the board sending the **"Hello World!"** back to you, because the script is run on the board, not on the computer. This means everything is successful, and you are ready to start writing MicroPython scripts!
107-
![Hello world from the board.]()
96+
1. In the text area field of the editor, write `print("Hello World!")`, and then click on the play symbol (RUN).
97+
![Write hello world.](assets/write-code-run.png)
98+
2. After running it, you should see `Hello World!` in the black box. This is the board sending the **"Hello World!"** back to you, because the script is run on the board, not on the computer. This means everything is successful, and you are ready to start writing MicroPython scripts!
99+
![Hello world from the board.](assets/repl-print.png)
108100

109101
## Troubleshooting
110102

Loading
Loading
Loading
Loading

content/micropython/03.micropython/00.first-steps/02.first-sketch/first-sketch.md renamed to content/micropython/03.micropython/00.first-steps/02.first-script/first-script.md

+6-8
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,9 @@ MicroPython is officially supported on several Arduino boards. Here’s a list o
4343

4444
1. Open the [Arduino Lab for MicroPython]() application.
4545
2. Plug the Arduino board into the computer using a USB cable.
46-
![Connect board to computer.]()
47-
3. Press the connection button on the top left corner of the window.
48-
![Connect the editor to the board.]()
49-
4. The connected Arduino board should appear, and we can click it:
50-
![Select board.]()
46+
![Connect board to computer.](assets/usb-comp.png)
47+
3. Press the connection button on the top left corner of the window. The connected Arduino board should appear (by its port name), and we can click it:
48+
![Connect to the board in the editor.](assets/select-board-ide.png)
5149

5250
***Need help installing MicroPython on your board? Visit the [MicroPython installation guide]().***
5351

@@ -56,7 +54,7 @@ MicroPython is officially supported on several Arduino boards. Here’s a list o
5654
Once your board is connected, we can start writing code! Below you will find a basic example, that will flash the built in LED on your board every second.
5755

5856
1. First, open the `main.py` file on your board. We write in this file, because once saved, the code will run even if you reset the board.
59-
![Open main.py file.]()
57+
![Open main.py file.](assets/open-files.png)
6058

6159
2. Copy and paste the following code into your editor:
6260
```python
@@ -78,11 +76,11 @@ Once your board is connected, we can start writing code! Below you will find a b
7876
***Note: The built-in LED pin varies from board to board. For example, on the Arduino Nano RP2040 Connect, the built-in LED is on pin `25`.***
7977

8078
3. Click the **Run** button in your editor to transfer the script to your board.
81-
![Run the script.]()
79+
![Run the script.](assets/run-script.png)
8280

8381
Once the script is running, the LED on the board should start blinking at one-second intervals. This means our MicroPython script has loaded successfully.
8482

85-
![LED blinking on your board.]()
83+
![LED blinking on your board.](assets/blink.gif)
8684

8785
### Code Breakdown
8886

Loading
Loading
Loading
Loading
Loading

content/micropython/03.micropython/01.basics/00. digital-io/digital-io.md

+6-10
Original file line numberDiff line numberDiff line change
@@ -62,11 +62,9 @@ In this guide, we will be using some additional electronic components:
6262

6363
1. Open the [Arduino Lab for MicroPython]() application.
6464
2. Plug the Arduino board into the computer using a USB cable.
65-
![Connect board to computer.]()
66-
3. Press the connection button on the top left corner of the window.
67-
![Connect the editor to the board.]()
68-
4. The connected Arduino board should appear, and we can click it:
69-
![Select board.]()
65+
![Connect board to computer.](assets/usb-comp.png)
66+
3. Press the connection button on the top left corner of the window. The connected Arduino board should appear (by its port name), and we can click it:
67+
![Connect to the board in the editor.](assets/select-board-ide.png)
7068

7169
***Need help installing MicroPython on your board? Visit the [MicroPython installation guide]().***
7270

@@ -83,7 +81,7 @@ Connect an LED to the Arduino board, following the circuit diagram below:
8381
- Connect the anode (+) of the LED to a digital output pin.
8482
- Connect the cathode (-) of the LED through a resistor to `GND`.
8583

86-
![LED circuit.]()
84+
![LED circuit.](assets/LED.png)
8785

8886
***You can also use the built-in LED on your board, if you do not have an external LED.***
8987

@@ -133,16 +131,14 @@ When a digital input pin is not connected to a definite HIGH or LOW voltage, it
133131

134132
These internal resistors are built into the microcontroller and can be enabled in your code, eliminating the need for external resistors.
135133

136-
![We can create a image here to explain that]()
137-
138134
### Example: Pull-Up Mode
139135

140136
In pull-up mode, the input pin is internally connected to a HIGH voltage level. When the input device (like a button) is activated and connects the pin to GND, the pin reads LOW (`0`).
141137

142138
- Connect one side of the button to **GND**.
143139
- Connect the other side to a digital input pin.
144140

145-
![Pull-up mode circuit.]()
141+
![Pull-up mode circuit.](assets/pull-up.png)
146142

147143
After completing the circuit diagram, copy the following code into your editor, and run the script.
148144

@@ -181,7 +177,7 @@ In pull-down mode, the input pin is internally connected to GND. When the input
181177
- Connect one side of the button to **3.3V** (or **5V**, depending on your board's logic level).
182178
- Connect the other side to a digital input pin.
183179

184-
![Pull-down mode circuit.]()
180+
![Pull-down mode circuit.](assets/pull-down.png)
185181

186182
After completing the circuit diagram, copy the following code into your editor, and run the script.
187183

content/micropython/03.micropython/01.basics/01. analog-io/analog-io.md

+6-8
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,9 @@ In this guide, we will be using some additional electronic components:
5454

5555
1. Open the [Arduino Lab for MicroPython]() application.
5656
2. Plug the Arduino board into the computer using a USB cable.
57-
![Connect board to computer.]()
58-
3. Press the connection button on the top left corner of the window.
59-
![Connect the editor to the board.]()
60-
4. The connected Arduino board should appear, and we can click it:
61-
![Select board.]()
57+
![Connect board to computer.](assets/usb-comp.png)
58+
3. Press the connection button on the top left corner of the window. The connected Arduino board should appear (by its port name), and we can click it:
59+
![Connect to the board in the editor.](assets/select-board-ide.png)
6260

6361
***Need help installing MicroPython on your board? Visit the [MicroPython installation guide]().***
6462

@@ -87,7 +85,7 @@ For this example, we will need the following external components:
8785

8886
Connect the photoresistor to the Arduino board, following the circuit diagram below:
8987

90-
![Photoresistor circuit.]()
88+
![Photoresistor circuit.](assets/photoresistor.png)
9189

9290
After completing the circuit diagram, copy the following code into your editor, and run the script.
9391

@@ -126,7 +124,7 @@ PWM is especially useful in applications where true analog output is not possibl
126124

127125
The main advantage of PWM is that it allows you to control analog-like behavior using digital pins, adding versatility to your projects while keeping power consumption efficient.
128126

129-
![How PWM works.]()
127+
![How PWM works.](assets/pwm.gif)
130128

131129
### Code Example: Dimming an LED with PWM
132130

@@ -141,7 +139,7 @@ For this example, we will need the following external components:
141139

142140
Connect the LED to the Arduino board, following the circuit diagram below:
143141

144-
![Photoresistor circuit.]()
142+
![LED circuit.](assets/LED.png)
145143

146144
After completing the circuit diagram, copy the following code into your editor, and run the script.
147145

Loading
Loading
Loading
Loading
Loading
Loading
Loading

content/micropython/03.micropython/01.basics/02. loops/loops.md

+3-8
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,9 @@ MicroPython is officially supported on several Arduino boards. Here’s a list o
4343

4444
1. Open the [Arduino Lab for MicroPython]() application.
4545
2. Plug the Arduino board into the computer using a USB cable.
46-
![Connect board to computer.]()
47-
3. Press the connection button on the top left corner of the window.
48-
![Connect the editor to the board.]()
49-
4. The connected Arduino board should appear, and we can click it:
50-
![Select board.]()
46+
![Connect board to computer.](assets/usb-comp.png)
47+
3. Press the connection button on the top left corner of the window. The connected Arduino board should appear (by its port name), and we can click it:
48+
![Connect to the board in the editor.](assets/select-board-ide.png)
5149

5250
***Need help installing MicroPython on your board? Visit the [MicroPython installation guide]().***
5351

@@ -63,11 +61,8 @@ To better understand these loops, let’s imagine them as tasks at the supermark
6361

6462
- **for loops** - imagine walking down a supermarket aisle with a shopping list that specifies exactly how many items to pick up, one by one, in order. Once you’ve gathered all the items on your list, your task is complete. This is like a `for` loop iterating over a sequence, handling each specified item one at a time.
6563

66-
![How for loops work.]()
67-
6864
- **while loops** - imagine going to the supermarket to buy a certain product that’s on sale, as long as it stays in stock. You keep coming back, day after day, until the sale ends or the stock runs out. In a `while` loop, you keep “coming back” as long as a condition (like the sale continuing) remains true.
6965

70-
![How while loops work.]()
7166

7267
## For Loops
7368

Loading
Loading

content/micropython/03.micropython/01.basics/03.data-logger/data-logger.md

+3-5
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,9 @@ MicroPython is officially supported on several Arduino boards. Here’s a list o
4545

4646
1. Open the [Arduino Lab for MicroPython]() application.
4747
2. Plug the Arduino board into the computer using a USB cable.
48-
![Connect board to computer.]()
49-
3. Press the connection button on the top left corner of the window.
50-
![Connect the editor to the board.]()
51-
4. The connected Arduino board should appear, and we can click it:
52-
![Select board.]()
48+
![Connect board to computer.](assets/usb-comp.png)
49+
3. Press the connection button on the top left corner of the window. The connected Arduino board should appear (by its port name), and we can click it:
50+
![Connect to the board in the editor.](assets/select-board-ide.png)
5351

5452
***Need help installing MicroPython on your board? Visit the [MicroPython installation guide]().***
5553

0 commit comments

Comments
 (0)