from hal_gpio import GPIOHAL
import time
gpio = GPIOHAL()
LED_PIN = 2
BUTTON_PIN = 4
gpio.set_output(LED_PIN, 1)
time.sleep(1)
gpio.set_output(LED_PIN, 0)
print("Press the button...")
while True:
button_state = gpio.read_input(BUTTON_PIN)
if button_state == 1:
print("Button Pressed!")
gpio.toggle_led(LED_PIN, 0.5)