Skip to content

Commit 5ebc29f

Browse files
committed
Review MicroPython - Introduction
1 parent d0182e8 commit 5ebc29f

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

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

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,23 +6,23 @@ author: 'Pedro Lima'
66
hero_image: "./hero-banner.png"
77
---
88

9-
# Intro to MicroPython
10-
119
MicroPython is a lightweight implementation of Python 3 designed to run on microcontrollers and embedded systems. Think of it as a mini-version of Python, tailored for hardware with limited resources like memory and processing power. Despite its smaller size, MicroPython retains the simplicity and flexibility of Python, making it an excellent option for programming hardware.
1210

1311
## MicroPython on Arduino Boards
1412

15-
When using MicroPython on Arduino boards, the language is installed directly onto the microcontroller. This allows the board to interpret and run Python code. Once MicroPython is installed on your board (don't worry, we'll cover installation in a future article), you can start writing and executing Python scripts instantly.
13+
![Placeholder graphic]()
14+
15+
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

17-
Unlike traditional development approaches, where you compile code and then flash it to the board, with MicroPython you write Python scripts and load them directly onto the microcontroller. This makes the development process much faster and more interactive.
17+
Unlike traditional development approaches, where you compile code and then flash it to the board, with MicroPython you write Python scripts and run them instantly on your Arduino. This makes the development process much faster and more interactive.
1818

1919
## Running Programs in MicroPython
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 imediate change
23+
![TODO: Image of code edit with immediate change]()
2424

25-
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.
25+
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

2727
### How it Works
2828

@@ -36,21 +36,21 @@ 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.
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.]()
4040

4141
## How to Program for MicroPython
4242

43-
Programming in MicroPython involves writing Python scripts in a text editor and uploading them to the board. Many IDEs, like Thonny or even Arduino IDE, provide support for MicroPython, allowing you to write and upload code easily.
43+
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]().
4444

4545
When writing MicroPython code, it's essential to think in terms of **modularity**. A good practice is to break down your code into smaller, reusable modules rather than writing everything in one large file. This approach makes it easier to manage and maintain code, especially for larger projects.
4646

4747
### Structuring Your Code
4848

49-
1. **Main Logic**: This would typically go into `main.py`. You can think of it as your "sketch" in Arduino terms.
49+
1. **Main Logic**: This goes into the `main.py` file. You can think of it as your "sketch" in Arduino terms.
5050
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.
5151
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.
5252

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.
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.]()
5454

5555
## MicroPython vs. C++ for Electronics Projects
5656

@@ -60,6 +60,6 @@ MicroPython offers a different approach to programming compared to the tradition
6060
- **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.
6161
- **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.
6262

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.
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.]()
6464

6565
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.

0 commit comments

Comments
 (0)