diff --git a/rp2040_client/main.py b/rp2040_client/main.py index 77014da..79e39d2 100644 --- a/rp2040_client/main.py +++ b/rp2040_client/main.py @@ -1,4 +1,5 @@ import time +from machine import Pin from umqtt.simple import MQTTClient @@ -6,9 +7,20 @@ import network import time from math import sin +led = Pin("LED", Pin.OUT) +led.value(1) + +button = Pin(14, Pin.IN, Pin.PULL_UP) + # Received messages from subscriptions will be delivered to this callback def sub_cb(topic, msg): print((topic, msg)) + if msg == b'on': + print("turn LED on") + led.value(1) + elif msg == b'off': + print("turn LED off") + led.value(0) def main(server="192.168.1.59"):