User Tools

Site Tools


gpio_controlled_leds

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
gpio_controlled_leds [2026/06/17 16:31] – [Introduction] walkeradmingpio_controlled_leds [2026/06/30 21:01] (current) walkeradmin
Line 13: Line 13:
 \\  \\ 
 \\  \\ 
-{{ :pico-non-wireless-pinout-with-leds-wiring.png?400 |}}+{{ :pico-non-wireless-pinout-with-leds-wiring.png?300 |}}
 \\  \\ 
 We have wired the LEDs to GPIO pins 2, 6 & 10. These are the GPIO Pin numbers, not the actual Pi Pico Pin numbers. We have wired the LEDs to GPIO pins 2, 6 & 10. These are the GPIO Pin numbers, not the actual Pi Pico Pin numbers.
Line 20: Line 20:
 Below is the software being used to drive the LEDs Below is the software being used to drive the LEDs
 \\  \\ 
-<code | download>+<code:python | download>
 # Start by importing lib files "machine" & "time" # Start by importing lib files "machine" & "time"
 # Imports the machine module, which provides access to hardware features such as GPIO pins, ADCs, PWM, etc. # Imports the machine module, which provides access to hardware features such as GPIO pins, ADCs, PWM, etc.
Line 27: Line 27:
 import time import time
  
-#we're initalizing pin 25 (which is the onboard LED) & pins 2, 6 and as outputs+#we're initalizing pin 25 (which is the onboard LED) & GPIO pins 2, 6 and 10 as outputs (These are the GPIO numbers, not the actual pin numbers around the PCB).
 # Creates a pin object called led1. # Creates a pin object called led1.
 # Uses GPIO pin 25. # Uses GPIO pin 25.
Line 33: Line 33:
 # On a Raspberry Pi Pico, GPIO 25 is usually connected to the onboard LED. # On a Raspberry Pi Pico, GPIO 25 is usually connected to the onboard LED.
 led1 = machine.Pin(25, machine.Pin.OUT) led1 = machine.Pin(25, machine.Pin.OUT)
-# Creates an output pin object for GPIO 2.+# Creates an output pin object for GPIO 2 (GP2).
 led2 = machine.Pin(2, machine.Pin.OUT) led2 = machine.Pin(2, machine.Pin.OUT)
-# Creates an output pin object for GPIO 6.+# Creates an output pin object for GPIO 6 (GP6).
 led3 = machine.Pin(6, machine.Pin.OUT) led3 = machine.Pin(6, machine.Pin.OUT)
-# Creates an output pin object for GPIO 10.+# Creates an output pin object for GPIO 10 (GP10).
 led4 = machine.Pin(10, machine.Pin.OUT) led4 = machine.Pin(10, machine.Pin.OUT)
  
Line 88: Line 88:
 \\  \\ 
   * Import Libraries (Machine and Time)   * Import Libraries (Machine and Time)
-  *  + 
-  * Set GPIO Pins to output+  * Set GPIO Pins to output
  
   * Start a loop that will loop 5 times   * Start a loop that will loop 5 times
gpio_controlled_leds.1781713867.txt.gz · Last modified: by walkeradmin