/*
* LAB Name: Raspberry Pi Pico Digital Inputs & Outputs (C/C++ SDK)
* Author: Khaled Magdy
* For More Info Visit: www.DeepBlueMbedded.com
*/
#include "pico/stdlib.h"
#define LED_PIN 20
#define BTN_PIN 21
int main()
{
gpio_init(LED_PIN);
gpio_set_dir(LED_PIN, GPIO_OUT);
gpio_init(BTN_PIN);
gpio_set_dir(BTN_PIN, GPIO_IN);
while (1)
{
while(gpio_get(BTN_PIN))
{
gpio_put(LED_PIN, 1);
}
gpio_put(LED_PIN, 0);
}
}