Skip to content

1.8.97 #1091

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 14, 2023
Merged

1.8.97 #1091

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
author: 'Karl Söderby'
title: 'MicroPython with Arduino Boards'
description: 'Learn about compatibility between the popular MicroPython implementation and Arduino boards, how to set up your environment, and discover in-depth tutorials and useful links.'
tags:
tags:
- MicroPython
- Arduino Lab
- OpenMV
Expand All @@ -11,7 +11,7 @@ hero_position: 1

***To download the firmware required to run MicroPython on your Arduino board, visit the [Arduino MicroPython downloads page](/micropython).***

[MicroPython](https://micropython.org/) is an implementation of the [Python® programming language](https://www.python.org/) that comes with a subset of the Python® standard library, and is designed **to run on microcontrollers**.
[MicroPython](https://micropython.org/) is an implementation of the [Python® programming language](https://www.python.org/) that comes with a subset of the Python® standard library, and is designed **to run on microcontrollers**.

A great advantage of using MicroPython is that it is easy to learn and has [great documentation](http://docs.micropython.org/en/latest/) for a number of boards. At the moment, there are four boards that can be used together with MicroPython, you can read more about them in the [compatible boards section](#compatible-boards).

Expand Down Expand Up @@ -44,22 +44,22 @@ As MicroPython is already running on the board, we don't need to compile and upl

![Arduino Lab for MicroPython Editor](assets/mpylabs-ss.png)

The [Arduino Lab for MicroPython](https://labs.arduino.cc/en/labs/micropython) is a lightweight editor designed for simple interaction between your computer and board. With it, you can select your port, load scripts, and use the REPL shell and more.
The [Arduino Lab for MicroPython](https://labs.arduino.cc/en/labs/micropython) is a lightweight editor designed for simple interaction between your computer and board. With it, you can select your port, load scripts, and use the REPL shell and more.

- [Download Arduino Lab for MicroPython Editor](https://labs.arduino.cc/en/labs/micropython).
- [MicroPython Firmware downloads page](/micropython).

## OpenMV Editor

[OpenMV](https://openmv.io/) is a platform that supports programming Arduino boards using a fork of MicroPython. Through the OpenMV editor, we can install this fork, and upload scripts directly to the board. There's also a number of examples available directly in the editor.
[OpenMV](https://openmv.io/) is a platform that supports programming Arduino boards using a fork of MicroPython. Through the OpenMV editor, we can install this fork, and upload scripts directly to the board. There's also a number of examples available directly in the editor.

OpenMV is a great platform for computer vision and machine learning projects.

![The OpenMV editor.](assets/openmv-ss.png)

### OpenMV Examples

Further down this article, you can find a lot of useful code examples that will help you to get started.
Further down this article, you can find a lot of useful code examples that will help you to get started.

***You can also check out the full list of examples in the [OpenMV's GitHub repository](https://github.com/openmv/openmv/tree/master/scripts/examples/10-Arduino-Boards).***

Expand All @@ -84,7 +84,7 @@ All of above are also compatible with the **OpenMV IDE**.
If you need help getting started with MicroPython on the **Nano 33 BLE** board, you can check out the tutorials below:

- [Install MicroPython on your Nano BLE](/tutorials/nano-33-ble-sense/micropython-installation#arduino-nano-33-ble).
- [Getting started with OpenMV and Nano 33 BLE](/tutorials/nano-33-ble/getting-started-omv)
- [Getting started with OpenMV and Nano 33 BLE](/tutorials/nano-33-ble/getting-started-omv)
- [Nano 33 BLE Python® API guide](/tutorials/nano-33-ble/ble-python-api) (a collection of useful scripts).

***To reset the bootloader on the Nano 33 BLE board, double tap the reset button quickly. This will reset your board to factory setting.***
Expand All @@ -93,7 +93,7 @@ If you need help getting started with MicroPython on the **Nano 33 BLE** board,

![The Nano 33 BLE + BLE Sense](assets/hero-ble-sense.png)

If you need help getting started with MicroPython on the **Nano 33 BLE Sense** board, you can check out the tutorials below:
If you need help getting started with MicroPython on the **Nano 33 BLE Sense** board, you can check out the tutorials below:

- [Install MicroPython on your Nano BLE Sense](/tutorials/nano-33-ble-sense/micropython-installation#arduino-nano-33-ble).
- [Getting started with OpenMV and Nano 33 BLE Sense](/tutorials/nano-33-ble-sense/getting-started-omv)
Expand All @@ -107,14 +107,14 @@ If you need help getting started with MicroPython on the **Nano 33 BLE Sense** b

If you need help getting started with MicroPython on the **Nano RP2040 Connect** board, you can check out the tutorials below:

- [Install MicroPython on your Nano RP2040 Connect](/tutorials/nano-rp2040-connect/micropython-installation#arduino-nano-rp2040-connect)
- [Install MicroPython on your Nano RP2040 Connect](/tutorials/nano-rp2040-connect/micropython-installation#arduino-nano-rp2040-connect)
- [Nano RP2040 Connect Python® guide](/tutorials/nano-rp2040-connect/rp2040-python-api)
- [Getting Started with OpenMV and MicroPython on Nano RP2040 Connect](/tutorials/nano-rp2040-connect/rp2040-openmv-setup)


***To reset the bootloader, you will need to short to connect a jumper wire between the REC and GND pin, and press the reset button. More detailed instructions are available in the [Nano RP2040 Connect technical reference](/tutorials/nano-rp2040-connect/rp2040-01-technical-reference#board-not-detected).***

### GIGA R1
### GIGA R1

![The GIGA R1](./assets/giga-r1.png)

Expand Down Expand Up @@ -180,7 +180,7 @@ while True:

### Functions

This script prints `"Hello world!"` every second. In addition, `counter_function()` also
This script prints `"Hello world!"` every second. In addition, `counter_function()` also

```python
import time
Expand Down Expand Up @@ -222,11 +222,11 @@ while True:
for x in range(10):
function_increase()
time.sleep(1)

for x in range(10):
function_decrease()
time.sleep(1)

```

### Digital Write
Expand All @@ -242,7 +242,7 @@ p2 = Pin(25, Pin.OUT)
while True:
p2.value(0)
print("off")
utime.sleep(1)
utime.sleep(1)
p2.value(1)
print("on")
utime.sleep(1)
Expand Down Expand Up @@ -288,18 +288,18 @@ import time

# Make sure to follow the GPIO map for the board you are using.
# Pin 29 in this case is the "A3" pin on the Nano BLE / BLE Sense
adc_pin = machine.Pin(29)
adc_pin = machine.Pin(29)
adc = machine.ADC(adc_pin)

while True:
reading = adc.read_u16()
reading = adc.read_u16()
print("ADC: ",reading)
time.sleep_ms(500)
```

### PWM

Write a specific duty to a specific pin.
Write a specific duty to a specific pin.

```python
from machine import Pin, PWM, ADC
Expand Down Expand Up @@ -327,7 +327,7 @@ while True:

### Interrupt

Below is an example of a simple interrupt that uses a pull up button and an LED.
Below is an example of a simple interrupt that uses a pull up button and an LED.

The program blinks an LED, until the button is pressed. The button is attached to an interrupt, which turns off an LED for 3 seconds.

Expand All @@ -336,25 +336,25 @@ import machine
from machine import Pin
import time

interrupt = False
interrupt = False

def callback(pin):
global interrupt
interrupt = True

led = Pin(6, Pin.OUT)

button = machine.Pin(25, machine.Pin.IN, machine.Pin.PULL_UP)

button.irq(trigger=machine.Pin.IRQ_FALLING, handler=callback)

while True:

led.on()
time.sleep(0.5)
led.off()
time.sleep(0.5)

if interrupt:
state = machine.disable_irq()
machine.enable_irq(state)
Expand All @@ -363,4 +363,3 @@ while True:
time.sleep(3)
interrupt = False
```

26 changes: 12 additions & 14 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
},
"homepage": "https://github.com/arduino/docs-content#readme",
"dependencies": {
"@arduino/docs-arduino-cc": "^1.8.92",
"@arduino/docs-arduino-cc": "^1.8.97",
"gatsby": "^4.9.2"
},
"volta": {
Expand Down