Différences entre versions de « ENG-CANSAT-PICO-HowTo »
Ligne 100 : | Ligne 100 : | ||
|label=Pico Python SDK | |label=Pico Python SDK | ||
|descr=Advanced documentation for MicroPython environment on RP2040. | |descr=Advanced documentation for MicroPython environment on RP2040. | ||
− | |img=tlogo-pico-python-sdk2. | + | |img=tlogo-pico-python-sdk2.png |
|url=https://datasheets.raspberrypi.com/pico/raspberry-pi-pico-python-sdk.pdf | |url=https://datasheets.raspberrypi.com/pico/raspberry-pi-pico-python-sdk.pdf | ||
}} | }} | ||
Ligne 106 : | Ligne 106 : | ||
{{ttuto | {{ttuto | ||
|label=Pico debugging | |label=Pico debugging | ||
− | |descr=Debugging using another | + | |descr=Debugging using another Pico (PicoProbe) |
|img=tlogo-pico-python-sdk.jpg | |img=tlogo-pico-python-sdk.jpg | ||
|url=https://www.raspberrypi.com/documentation/microcontrollers/raspberry-pi-pico.html#debugging-using-another-raspberry-pi-pico | |url=https://www.raspberrypi.com/documentation/microcontrollers/raspberry-pi-pico.html#debugging-using-another-raspberry-pi-pico |
Version du 21 février 2022 à 00:30
MicroPython How To
This section of the tutoriel contains small portion of code explaining how to use digital pins, analog pins, buses and all the fundamentals to control the board with Python code.
Control an output
The onboard LED is tied to the GPIO 25. Here how to control it.
from machine import Pin
led = Pin(25, Pin.OUT)
led.value(1) # Switch on the LED
led.value(0) # Switch off the LED
This will work the same with any GPIO pins.
Input Reading
The onboard LED is tied to the GPIO 25. Here how to control it.
from machine import Pin
x
x
x
x
Analog Reading
The onboard LED is tied to the GPIO 25. Here how to control it.
from machine import Pin
x
x
x
x
PWM Output
The onboard LED is tied to the GPIO 25. Here how to control it.
from machine import Pin
x
x
x
x
Hardware buses
I2C Bus
The onboard LED is tied to the GPIO 25. Here how to control it.
from machine import Pin
x
x
x
x
UART Bus
The onboard LED is tied to the GPIO 25. Here how to control it.
from machine import Pin
x
x
x
x
SPI Bus
The onboard LED is tied to the GPIO 25. Here how to control it.
from machine import Pin
x
x
x
x
Additional tutorials
Anyway, the followings are also goods and complete references.
Written by Meurisse D. for MCHobby