Différences entre versions de « ENG-CANSAT-PICO-HowTo »
Sauter à la navigation
Sauter à la recherche
(Page créée avec « {{ENG-CANSAT-PICO-NAV}} == MicroPython How To == This section of the tutoriel contains small portion of code explaining how to use digital pins, analog pins, buses and al… ») |
|||
Ligne 7 : | Ligne 7 : | ||
== Control an output == | == Control an output == | ||
The onboard LED is tied to the GPIO 25. Here how to control it. | The onboard LED is tied to the GPIO 25. Here how to control it. | ||
− | |||
− | |||
<syntaxhighlight lang="python"> | <syntaxhighlight lang="python"> | ||
Ligne 16 : | Ligne 14 : | ||
led.value(0) # Switch off the LED | led.value(0) # Switch off the LED | ||
</syntaxhighlight> | </syntaxhighlight> | ||
+ | |||
+ | This will work the same with any GPIO pins. | ||
{{ENG-CANSAT-PICO-TRAILER}} | {{ENG-CANSAT-PICO-TRAILER}} |
Version du 20 février 2022 à 23:53
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.
Written by Meurisse D. for MCHobby