This lesson teaches you to
- Connect a button to GPIO
- Connect an LED to GPIO
You should also read
Before writing any code, you need to connect peripherals from your development kit to your board.
In this lesson, you will learn to wire a pushbutton switch and LED from a breadboard to your device. To connect the peripherals to your board:
- Connect one side of the button to the chosen GPIO input pin, and the other side to ground.
- Connect the same GPIO input pin to +3.3V through a pull-up resistor.
- Connect the chosen GPIO output pin to one side of a series resistor.
- Connect the other side of the resistor to the anode side (longer lead) of the LED.
- Connect the cathode side (shorter lead) of the LED to ground.
For this lesson, the following GPIO pins are assumed on each board:
|Board||Input Signal||Output Signal|
|NXP Pico i.MX6UL||GPIO4_IO20||GPIO4_IO21|
|NXP Pico i.MX7D||GPIO2_IO07||GPIO2_IO02|