diff --git a/main.py b/main.py index b48f27e..33adec8 100644 --- a/main.py +++ b/main.py @@ -1,5 +1,7 @@ import usocket as socket import ssl +from machine import Pin +import time with open('token') as f: token = f.readline().strip('\n') @@ -48,9 +50,20 @@ Content-Length: {content_length}\r s.close() +def simple_msg(): + send_msg("Hello there from the button") def main(): - send_msg("Hello there") - + p2 = Pin(2, Pin.IN) + while True: + cur_value = p2.value() + active = 0 + while active < 20: + if p2.value() != cur_value: + active += 1 + else: + active = 0 + time.sleep_ms(1) + simple_msg() main()