To check single LED blink using push button
Required Components
- LED _ 1 no
- 220 Ω Resistor_ 1 no
- 10 K Ω Resistor _1 no
- Pushbutton _1 no
- Bread Board _1 no
- Raspberry Pi Pico _1 no
- Connecting wires _1 Set
Circuit
Steps
- Make sure the components are working properly.
- Connect Raspberry Pi Pico board VBus and GND pin to the bread board by using wires.
- Connect 220 Ω Resistor to the LED Anode (+) pin and cathode (-) pin to Gnd.
- Connect 220 Ω Resistor another pin to GP16.
- Connect 10 k Ω Resistor to the switch button.
- Connect switch button another pin to the Raspberry Pi Pico pin GP17.
- When we press the push button LED blinks.
- Check the Arduino program.
- Check the circuit connections.
- Run the Arduino program.
Arduino Program
int ledPin = 16;
int buttonPin = 17;
void setup()
{
pinMode(ledPin, OUTPUT);
pinMode(buttonPin, INPUT);
}
void loop()
{
int button = digitalRead(buttonPin);
if (button==HIGH)
{
digitalWrite(ledPin,HIGH);
}
else
{
digitalWrite(ledPin, LOW);
}
}