Esempio n. 1
0
print("--- octopusLAB: test_led ---")

print("-> init")
from components.led import Led
led = Led(2)

print("-> blink()")
led.blink()

print("-> value() | toggle()")
led.value(1)
led.toggle()

print("-" * 30)
Esempio n. 2
0
def boot_button_on_long_press():
    print('boot_button_on_long_press')


print("--- wifi_connect >")
net = WiFiConnect()
net.connect()

print("--- mqtt_connnect >")
# c = mqtt_connect_from_config(esp_id)
m = MQTT.from_config()
c = m.client

c.set_callback(mqtt_handler)
c.connect()
c.subscribe("octopus/device/{0}/#".format(m.client_id))

print("testing blink")
built_in_led.value(1)
sleep(1)
built_in_led.value(0)

print("send alive message")
c.publish("octopus/device", m.client_id)  # topic, message (value) to publish

print("--- RAM free ---> " + str(mem_free()))
print("--- main loop >")
while True:
    c.check_msg()
    # sleep(5)