import BlynkLib
import machine

BLYNK_AUTH = 'kFcv94Fhy0j8wh0GPS8vxrgKJ9O3r3hd'
LED_PIN = 12

# Initialize Blynk
blynk = BlynkLib.Blynk(BLYNK_AUTH)

# Set GPIO mode and LED pin
led = machine.Pin(LED_PIN, machine.Pin.OUT)

# Virtual LED control handler
@blynk.handle_event('write V1')
def led_control(pin, value):
    if int(value[0]) == 1:
        led.on()
    else:
        led.off()

# Run Blynk
while True:
    blynk.run()