Raspberry Pi Pico: Difference between revisions
		
		
		
		Jump to navigation
		Jump to search
		
| Line 35: | Line 35: | ||
# this switches the LED off  | # this switches the LED off  | ||
myLED.off()  | myLED.off()  | ||
</syntaxhighlight>  | |||
=== blinking the LED ===  | |||
<syntaxhighlight lang="python" line='line'>  | |||
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)  | |||
</syntaxhighlight>  | </syntaxhighlight>  | ||
Revision as of 19:01, 4 January 2022
Links
Here are some links for the Raspberry Pi Pico board:
The starting page:
Board pinout
- https://www.raspberrypi.org/documentation/pico/getting-started/#board-specifications
 - https://datasheets.raspberrypi.org/pico/Pico-R3-A4-Pinout.pdf
 
MicroPython on the Raspberry Pi Pico
- https://www.raspberrypi.org/documentation/pico/getting-started/#getting-started-with-micropython
 - https://datasheets.raspberrypi.org/pico/raspberry-pi-pico-python-sdk.pdf
 
Related Video
Code Example
Control the internal LED with MicroPython
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
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)