Difference between revisions of "Raspberry Pi Pico"
Jump to navigation
Jump to search
(5 intermediate revisions by one other user not shown) | |||
Line 17: | Line 17: | ||
= Related Video = | = Related Video = | ||
− | + | <youtube>fnzKTF7lrZ8</youtube> | |
+ | <!-- | ||
[[File:Pipico02.PNG|800px|link=https://www.sketching-with-hardware.org/video/pipico01/pipico01_player.html]] | [[File:Pipico02.PNG|800px|link=https://www.sketching-with-hardware.org/video/pipico01/pipico01_player.html]] | ||
− | + | --> | |
= Code Example = | = Code Example = | ||
− | = Control the internal LED with MicroPython = | + | == Control the internal LED with MicroPython == |
The internal LED is connected to Pin 25. | The internal LED is connected to Pin 25. | ||
Line 35: | Line 36: | ||
myLED.off() | myLED.off() | ||
</syntaxhighlight> | </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> | ||
+ | |||
+ | [[Category:Raspberry Pi]] |
Latest revision as of 14:06, 12 June 2024
Contents
Links[edit]
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[edit]
Code Example[edit]
Control the internal LED with MicroPython[edit]
The internal LED is connected to Pin 25.
1 from machine import Pin
2 # the internal LED is connected to Pin 25, we use it as output
3 myLED = Pin(25, Pin.OUT)
4 # this switches the LED on
5 myLED.on()
6 # this switches the LED off
7 myLED.off()
blinking the LED[edit]
1 from machine import Pin
2 from time import sleep
3
4 # assume our LED is connected to Pin 26, we use it as output
5 myLED = Pin(25, Pin.OUT)
6
7 while True:
8 # this switches the LED on for 1 second
9 myLED.on()
10 sleep(1)
11 # this switches the LED off for 500 ms
12 myLED.off()
13 sleep(0.5)