Hi
For the following code,
import machine
import network
from umqtt.simple import MQTTClient
led = machine.Pin(D1, machine.Pin.OUT)
button = machine.Pin(D0, machine.Pin.IN)
sta_if = network.WLAN(network.STA_IF)
ap_if = network.WLAN(network.AP_IF)
ap_if.active(False)
sta_if.active(True)
sta_if.connect('my-Lan', 'My-passwoed')
client = MQTTClient("esp-button", "192.168.1.199")
client.connect()
while True:
if button.value() == 1:
led.value(1)
else:
led.value(0)
I'm experiencing the error below:
Traceback (most recent call last):
File "main.py", line 17, in <module>
File "umqtt/simple.py", line 56, in connect
OSError: [Errno 113] EHOSTUNREACH
Line 17 is client.connect().
The peculiarity is that the exact same code can be run without errors when imputed step by step into the interactive shell. Actually, as soon as the exception occurs and the control returns to the shell I can run client.connect() without errors (returns 0) which is shown in the MQTT broker log.
The version used is: MicroPython v1.8.7-7-gb5a1a20a3 on 2017-01-09 on ESP8266
Hi
For the following code,
I'm experiencing the error below:
Line 17 is
client.connect().The peculiarity is that the exact same code can be run without errors when imputed step by step into the interactive shell. Actually, as soon as the exception occurs and the control returns to the shell I can run
client.connect()without errors (returns 0) which is shown in the MQTT broker log.The version used is:
MicroPython v1.8.7-7-gb5a1a20a3 on 2017-01-09on ESP8266