I tried using this library and it generated an error for connect():
Code: Select all
from machine import Pin
import micropython,network,time
led = Pin(32, Pin.OUT, value=1)
l = network.LAN(mdc = Pin(23), mdio = Pin(18), power = Pin(17), phy_type = network.PHY_LAN8720, phy_addr=1)
I (17267) system_api: Base MAC address is not set, read default base MAC address from BLK0 of EFUSE
l.active(1)
I (18487) emac: emac reset done
True
I (18487) ethernet: start
I (22487) ethernet: LAN cable connected
I (23237) event: eth ip: 192.168.29.37, mask: 255.255.255.0, gw: 192.168.29.1
I (23237) ethernet: Got IP
from umqtt.simple import MQTTClient
I (49577) modsocket: Initializing
SERVER = "broker.mqttdashboard.com"
CLIENT_ID = "6pPjrbwL6h"
TOPIC = "testtopic/1"
c = MQTTClient(CLIENT_ID, SERVER)
c.connect()
Traceback (most recent call last):
File "", line 1, in
File "umqtt/simple.py", line 105, in connect
IndexError: bytes index out of range
Code: Select all
resp = self.sock.read(4)