import machine
import time
# Set up the GPIO pins for the LEDs
led_pin1 = machine.Pin(2, machine.Pin.OUT)
led_pin2 = machine.Pin(3, machine.Pin.OUT)
led_pin3 = machine.Pin(4, machine.Pin.OUT)
def blink_led(pin, duration):
pin.on()
time.sleep(duration)
pin.off()
time.sleep(0.5)
# Main loop
while True:
try:
weight = int(input("Enter your weight in kgs: "))
height = int(input("Enter your height in cm: "))
bmi_value = weight / ((height / 100) ** 2)
if bmi_value > 25:
blink_led(led_pin1, 3)
elif bmi_value > 18.9:
blink_led(led_pin2, 3)
else:
blink_led(led_pin3, 3)
except ValueError:
print("Invalid input. Please enter a valid integer.")