I have a problem with machine.reset when using an interupt to trigger the command machine.reset, the macine resets then I get the error
Code: Select all
File "main.py", line 4, in <module>
OSError: TCP/IP IF Not Ready
MicroPython v1.12-256-geae495a71 on 2020-03-12; ESP32 module with ESP32
Type "help()" for more information.
Main.py
Code: Select all
import network, ntptime, utime, machine
sta_if = network.WLAN(network.STA_IF)
sta_if.active(True)
sta_if.config(dhcp_hostname="ComputerPIR")
sta_if.connect('*******', '********')
print("Connecting ")
while not sta_if.isconnected():
print(".", end="")
utime.sleep(1)
try:
ntptime.settime()
except:
pass
import mqtt
Code: Select all
# Routine for the Interupt handler
def callback(pin):
global interruptCounter
interruptCounter = interruptCounter+1
# Setup the Interupt Counter
interruptCounter = 0
# Pin 25 for the push to make switch to allow reset
p25 = machine.Pin(25, machine.Pin.IN, machine.Pin.PULL_UP)
p25.irq(trigger=machine.Pin.IRQ_FALLING, handler=callback)
while True:
# CHeck the Interrupt and reset machine if button on Pin 25 is pressed
if interruptCounter>0:
machine.reset()
Can you please advise of what is going on ?
Regards Mike