Açıklama
|
#boot.pytry: import usocket as socketexcept: import socketfrom machine import Pinimport networkimport espesp.osdebug(None)import gcgc.collect()ssid = 'HUAWEI P smart 2019'password = '12345687'station = network.WLAN(network.STA_IF)station.active(True)station.connect(ssid, password)while station.isconnected() == False: passprint('Connection successful')print(station.ifconfig())#main.pyfrom urllib import urequestfrom time import sleepled = Pin(5, Pin.OUT) def sayfagetir(): response = urequest.urlopen("http://www.temelelektronik.info/relay.aspx?sensor=1") # set the correct charset below page_source = response.read().decode('Windows-1254') a=page_source.count('Green') print(a) if a==1: led.value(1) else: led.value(0) while True: sayfagetir() sleep(5)
|
|