Modifications

Sauter à la navigation Sauter à la recherche
577 octets ajoutés ,  19 février 2022 à 01:32
Ligne 89 : Ligne 89 :  
=== LED Blinking ===
 
=== LED Blinking ===
 
Now that we have selected the MicroPython REPL as interactive shell, can use it to control the Pico onboard LED.
 
Now that we have selected the MicroPython REPL as interactive shell, can use it to control the Pico onboard LED.
 +
 +
The Pico onboard LED is attached to the pin GP25.
 +
 +
[[Fichier:ENG-CANSAT-PICO-THONNY-03.png|480px]]
 +
 +
It can be controled with few lines of codes, just key-in them directly in the REPL session
 +
 +
<nowiki>from machine import Pin
 +
led = Pin(25, Pin.OUT)
 +
led.value(1) # allume la LED
 +
led.value(0) # éteint la LED</nowiki>
 +
 +
The following screen capture just show the results of entering the command lines.
 +
 +
[[Fichier:ENG-CANSAT-PICO-THONNY-04.png|480px]]
 +
 +
by entering {{fname|led.value()}} without parameter, you can query the output pin state (1 for High level, 0 for Low level).
    
{{ENG-CANSAT-PICO-TRAILER}}
 
{{ENG-CANSAT-PICO-TRAILER}}
29 917

modifications

Menu de navigation