uHodor/esp8266/main.py
2018-02-16 01:03:02 +01:00

13 lines
339 B
Python

from machine import Pin
from urequests import get
from time import sleep_ms
from gc import collect
pin = Pin(2, Pin.IN)
pin_value = pin.value()
while True:
current_value = pin.value()
if pin_value != current_value:
get('http://192.168.44.174:6543/value/%s' % current_value)
pin_value = current_value
collect()