Posts

Showing posts with the label Pyboard

How can we use MQTT protocol to send messages over micropython(esp32) board?

Concepts Basically, you got two actions available. One is publish . Another is subscribe . If we want to send some message out to others, we need to use publish . If we want to just receive messages from others, we use subscribe . publish  from umqtt.simple import MQTTClient c = MQTTClient( "clients/a" , SERVICE_IP) c.connect() c.publish( b"a_topic" , b"hello" ) c.disconnect() subscribe import time from umqtt.simple import MQTTClient # Received messages from subscriptions will be delivered to this callback def callback (topic, msg) : print((topic, msg)) c = MQTTClient( "clients/b" , SERVICE_IP) c.set_callback(callback) c.connect() c.subscribe( b"a_topic" ) while True : if True : # Blocking wait for message c.wait_msg() else : # Non-blocking wait for message c.check_msg() # Then need to sleep to avoid 100% CPU usage (in a real # app other useful actions woul...

How to update pyborad firmware

Image
Reason We need to use the async module for some advanced multiprocess usage. The Official Documentation https://github.com/micropython/micropython/wiki/Pyboard-Firmware-Update Install dfu-util sudo apt install dfu-util Download firmware Go to https://micropython.org/download/all Download a dfu file that fits your board. Let your board get into DFU mode This step varies depending on different boards. Backup or Restore your old firmware Backup: sudo dfu-util --alt 0 --upload pyboard-original.dat -s : 524288 Restore: sudo dfu-util --alt 0 -D pyboard-original.dat -d 0483 :df11 -s 0 x8000000 Upgrade your pyboard firmware sudo dfu-util --alt 0 -D pybv11- 20200902 -v1. 13 .dfu Author https://yingshaoxo.blogspot.com ​