i have a problem, hopefully you can help me.
After a soft-reset (CTRL-D in REPL), i get the error that there is no available NIC when using the urequest.post command. After a hard-reset everything is working fine.
Propably the re-initialization of the wifi interface is not done right, but the telnet-Repl is still alive?
boot.py:
Code: Select all
import machine
import os
from network import WLAN
import time
import pycom
import urequests
uart = machine.UART(0, baudrate=115200)
os.dupterm(uart)
wlan = WLAN()
if machine.reset_cause() != machine.SOFT_RESET:
wlan.mode(WLAN.STA)
if wlan.isconnected():
print('Already connected to WiFi network.')
else:
wlan.connect(net_to_use.ssid, auth=(net_to_use.sec, pw), timeout=10000)
while not wlan.isconnected():
time.sleep_ms(500)
print('.', end='')
print(' connected.')
machine.main('main.py')
Code: Select all
while true:
payload="status,volk={0} wert={1:0.2f} {2}".format(Volk_Nummer,Status,t)
response = urequests.post(db, data=payload)
time.sleep(20