Raspberry Pi Pico

From Sketching with Hardware at LMU Wiki
Jump to navigation Jump to search

Links[edit]

Here are some links for the Raspberry Pi Pico board:

The starting page:

Board pinout

MicroPython on the Raspberry Pi Pico

Related Video[edit]

  

Code Example[edit]

Control the internal LED with MicroPython[edit]

The internal LED is connected to Pin 25.

from machine import Pin
# the internal LED is connected to Pin 25, we use it as output 
myLED = Pin(25, Pin.OUT)
# this switches the LED on
myLED.on()
# this switches the LED off
myLED.off()

blinking the LED[edit]

from machine import Pin
from time import sleep 

# assume our LED is connected to Pin 26, we use it as output 
myLED = Pin(25, Pin.OUT)

while True:
      # this switches the LED on for 1 second
      myLED.on()
      sleep(1)
      # this switches the LED off for 500 ms
      myLED.off()
      sleep(0.5)