Skip to content

Commit 05eee48

Browse files
committed
Review MicroPython - First Script
1 parent 5ebc29f commit 05eee48

File tree

2 files changed

+45
-52
lines changed

2 files changed

+45
-52
lines changed

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

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
---
2-
featured: micropython
3-
title: '0. Introduction to MicroPython'
4-
description: 'Learn about Micropython'
2+
title: 'Introduction to MicroPython'
3+
description: 'Learn about the fundamentals of Micropython on Arduino boards.'
54
author: 'Pedro Lima'
65
hero_image: "./hero-banner.png"
76
---

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

+43-49
Original file line numberDiff line numberDiff line change
@@ -1,71 +1,65 @@
11
---
2-
featured: micropython-101
3-
title: '1. Installing micropython'
4-
description: 'Lern how to setup MicroPython'
2+
title: 'My First Script'
3+
description: 'Learn how to write a basic MicroPython script to blink an LED.'
54
author: 'Pedro Lima'
65
hero_image: "./hero-banner.png"
76
---
87

9-
# My First Script
8+
In this tutorial, we'll guide create our very first MicroPython script that will run on an Arduino board. We'll make an LED blink, a classic beginner project that introduces you to basic MicroPython programming concepts.
109

11-
In this article, we'll guide you through creating your first MicroPython script on your Arduino board. We'll make an LED blink. A classic beginner project that introduces you to basic programming concepts in MicroPython.
10+
## Hardware & Software Needed
1211

13-
## Requirements
12+
For this tutorial, you will need a MicroPython compatible Arduino Board:
1413

15-
### Hardware Boards
14+
- [Arduino Nano 33 BLE]()
15+
- [Arduino Nano ESP32]()
16+
- [Arduino Nano RP2040 Connect]()
17+
- [Arduino GIGA R1 WiFi]()
18+
- [Arduino Portenta H7]()
19+
- [Arduino Nicla Vision]()
1620

17-
- **Arduino Boards Compatible with MicroPython**:
18-
- Arduino Nano 33 BLE
19-
- Arduino Nano 33 IoT
20-
- Arduino Nano RP2040 Connect
21-
- Arduino Portenta H7
22-
- Arduino Nicla Vision
21+
You will also need the following software installed:
2322

24-
### Software (Editor)
23+
- [Arduino Lab for MicroPython](https://labs.arduino.cc/en/labs/micropython).
2524

26-
- **MicroPython-Compatible Editor**:
27-
- [Arduino IDE with MicroPython Support](https://www.arduino.cc/en/software).
28-
29-
## Introducing the Example: Blinking an LED
25+
## Board and Editor Setup
3026

3127
Blinking an LED is a simple yet effective way to get started with MicroPython while still understanding how to control hardware using code.
3228

33-
## Step-by-Step Guide
34-
35-
### 1. Open Your Editor
36-
37-
Launch your MicroPython-compatible editor (e.g., Arduino IDE or Thonny IDE).
29+
1. Connect your Arduino board to your computer via USB.
30+
2. Open the Arduino Lab for MicroPython application.
31+
3. Click on the **Connect** button, and select the board from the list.
3832

39-
### 2. Connect Your Board
33+
***Need help installing MicroPython on your board? Visit the [MicroPython installation guide]().***
4034

41-
Ensure your Arduino board is connected to your computer via USB.
35+
## First Script (LED Blink)
4236

43-
### 3. Write the Code
37+
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.
4438

45-
Copy and paste the following code into your editor:
39+
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.
40+
![Open main.py file.]()
4641

47-
```python
48-
import machine
49-
import time
50-
51-
led = machine.Pin(25, machine.Pin.OUT)
42+
2. Copy and paste the following code into your editor:
43+
```python
44+
import machine
45+
import time
5246

53-
while True:
54-
led.value(1)
55-
time.sleep(1)
56-
led.value(0)
57-
time.sleep(1)
58-
```
47+
led = machine.Pin(25, machine.Pin.OUT)
5948

60-
**Note**: On some boards, the built-in LED might be on a different pin. For example, on the Arduino Nano RP2040 Connect, the built-in LED is on pin `25`. Check your board's documentation to confirm the correct pin number.
49+
while True:
50+
led.value(1)
51+
time.sleep(1)
52+
led.value(0)
53+
time.sleep(1)
54+
```
6155

62-
### 4. Run the Script
56+
***Note: On some boards, the built-in LED might be on a different pin. For example, on the Arduino Nano RP2040 Connect, the built-in LED is on pin `25`. Check your board's documentation to confirm the correct pin number.***
6357

64-
Click the **Run** or **Upload** button in your editor to transfer the script to your board.
58+
3. Click the **Run** or **Upload** button in your editor to transfer the script to your board.
6559

66-
### 5. Observe the LED
60+
Once the script is running, the LED on your board should start blinking at one-second intervals. This means your MicroPython script has loaded successfully.
6761

68-
Once the script is running, the LED on your board should start blinking at one-second intervals.
62+
![LED blinking on your board.]()
6963

7064
## Programming Concepts Explained
7165

@@ -159,12 +153,12 @@ while True:
159153

160154
## Conclusion
161155

162-
Congratulations! You've written and modified your first MicroPython script on an Arduino board. This simple exercise introduced you to:
156+
Congratulations! You've written and modified your first MicroPython script on an Arduino board. This exercise introduced you to:
163157

164-
- Importing modules
165-
- Initializing hardware components
166-
- Using loops
167-
- Controlling time delays
158+
- Importing modules (`machine`, `time`)
159+
- Initializing hardware components (LED)
160+
- Using loops (`while`)
161+
- Controlling time delays (`time.sleep()`)
168162

169-
Although simple these concepts are key for a vast majoraty of the operations you will be performing when writing your own programs and are present in the industry at large.
163+
These concepts are key for a vast majoraty of the operations you will be performing when writing your own programs and are present in the industry at large.
170164

0 commit comments

Comments
 (0)