print("Hello, ESP32!")
print("This program is to make:\n")
print("\t a red LED turn ON for the wrong guessing\n")
print("\t a blue LED turn ON for the correct guessing\n")
from machine import Pin
from utime import sleep #utime since phyton is used
led_red = Pin(14, Pin.OUT) #Connect the LED to GPIO 14
led_blue = Pin(12, Pin.OUT) #Connect the LEd to GPIO 14
#parameter declaration
counter = 1
target = 30
while True: #forever loop
# Obtain input from the user:
value = int(input("Enter an integer between 1 and 100: "))
if value > target:
print("WRONG!", value, "is high/too high")
for i in range (5):
led_red.on()
sleep(0.4)
led_red.off()
sleep(0.4)
elif int(value) < target:
print("WRONG!", value, "is low/too low")
for i in range (5):
led_red.on()
sleep(0.4)
led_red.off()
sleep(0.4)
else:
print("PERFECT! KUDOS!")
for i in range (5):
led_blue.on()
sleep(0.5)
led_blue.off()
sleep(0.5)
break