urequests not working in main.py #10112
Replies: 2 comments
-
Does it help if the program waits for the connection by replacing this: if not wlan.isconnected():
wlan.connect(ssid, psk) with this: while not wlan.isconnected():
print("Waiting to connect...")
time.sleep(1) |
Beta Was this translation helpful? Give feedback.
-
I am pretty sure there are TWO problems. a) you don't wait until the connect() at the beginning of the program succeeds. b) "but it works with thonny" is an error on it's own. Just get your code working without a fancy IDE - use pyremote, rshell, putty, whatever. Inconvenient, yes, but any code working without thonny will run in thonny, too - but not necessary the other way around. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I have been trying to make a sensor that uploads its data to my server every few minutes, It seems to work if I run the code from the thonny editor but when I run the code from the main.py with no computer attached it gets stuck at urequests.post()
light turns off for 10 seconds when running from Thonny but never goes off when run directly from USB power
code is a little doubled up because it was split across the boot and main but get the same problem no matter where I put the code
Beta Was this translation helpful? Give feedback.
All reactions