Hello,
I’m trying to send a simple HTTP GET request every 5 seconds, but after 4 requests, the board hangs/crashes without giving an error. I have to reboot the board before I can work with it again. Am I creating a stack overflow or something?
I’m using the example including urequests.py from:
import network
import urequests
import time
from machine import Pin, Timer
timer = Timer()
def w5x00_init():
nic = network.WIZNET5K(machine.SPI(0), machine.Pin(17), machine.Pin(20))
nic.active(True) # DHCP
while not nic.isconnected():
time.sleep(1)
print('Connecting...')
def request(timer):
r = urequests.get("http://192.168.178.110:8000/controllers/status/test-1")
print('Status: ' + str(r.status_code))
r.close
def main():
w5x00_init()
timer.init(period=5000, callback=request)
if __name__ == "__main__":
main()