#Firebase HTTP Get
import network
import urequests
import json
from machine import Pin
import esp32
import time
Led1= Pin(2, Pin.OUT)
Led2= Pin(4, Pin.OUT)
wlan = network.WLAN(network.STA_IF)
wlan.active(True)
wlan.connect("Wokwi-GUEST","")
while not wlan.isconnected():
pass
print("WiFi..................connected")
URL = "https://led2-fa818-default-rtdb.firebaseio.com/Led's/.json"
while True:
response = urequests.get(URL)
print(response.text)
person_dict = json.loads(response.text)
print(person_dict)
print(person_dict['Led 1'])
print(person_dict['Led 2'])
if person_dict['Led 1']=="RED":
Led1.on()
if person_dict['Led 2']=="BLUE":
Led2.on()
time.sleep(1)