gpio_controlled_leds
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| gpio_controlled_leds [2026/06/17 16:31] – [Introduction] walkeradmin | gpio_controlled_leds [2026/06/30 21:01] (current) – walkeradmin | ||
|---|---|---|---|
| Line 13: | Line 13: | ||
| \\ | \\ | ||
| \\ | \\ | ||
| - | {{ : | + | {{ : |
| \\ | \\ | ||
| 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: |
| # Start by importing lib files " | # Start by importing lib files " | ||
| # 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 6 as outputs | + | #we're initalizing pin 25 (which is the onboard LED) & GPIO pins 2, 6 and 10 as outputs |
| # 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, | led1 = machine.Pin(25, | ||
| - | # Creates an output pin object for GPIO 2. | + | # Creates an output pin object for GPIO 2 (GP2). |
| led2 = machine.Pin(2, | led2 = machine.Pin(2, | ||
| - | # Creates an output pin object for GPIO 6. | + | # Creates an output pin object for GPIO 6 (GP6). |
| led3 = machine.Pin(6, | led3 = machine.Pin(6, | ||
| - | # Creates an output pin object for GPIO 10. | + | # Creates an output pin object for GPIO 10 (GP10). |
| led4 = machine.Pin(10, | led4 = machine.Pin(10, | ||
| Line 88: | Line 88: | ||
| \\ | \\ | ||
| * Import Libraries (Machine and Time) | * Import Libraries (Machine and Time) | ||
| - | * | + | |
| - | * 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
