Hi Sara,
How to save to flash not Ram?
Got the Web app to work finally.
But it only seems to save to RAM, not flash.
References:
- 192.168.1.148/?led=on
- https://github.com/RuiSantosdotme/ESP-MicroPython/tree/master/code/WiFi/Web_Server_Output_Simple
- MacBook Pro early 2015 Running current version of Monterey
- By they way I get an error trying to install uPyCraft – current version
- Using Thonny 3.3.13
Hi.
Thonny IDE interface has changed.
You need to upload the files to the board. Just running the files won’t work.
You need to upload boot.py and then, main.py.
To upload a file you need to go to File > Save as > MicroPython Device, select your board, and save the file as boot.py or main.py.
After uploading both files, you can reset the board and it should start running the code as expected.
Regards
Sara
Thanks Sara
1. I seem to be stuck, now I can’ reset the board, all I get is busy and I can’t stop it just get….
WARNING:root:Unexpected echo. Expected b’%Run -c $EDITOR_CONTENT\r\n’, got b”
Device is busy or does not respond. Your options:
– wait until it completes current work;
– use Ctrl+C to interrupt current work;
– use Stop/Restart to interrupt more and enter REPL
2. I an unable to Stop/Restart or Ctrl+C
No print(‘Connection successful’) are seen
3. My code follows, by the way I added led = Pin(2, Pin.OUT) to led.low()
Thanks,
Gary
# Complete project details at https://RandomNerdTutorials.com
#boot.py
try:
import usocket as socket
except:
import socket
from machine import Pin
import network
import esp
esp.osdebug(None)
import gc
gc.collect()
ssid = ssid = ‘My local Network wifi’
password = ‘password for local Network’
station = network.WLAN(network.STA_IF)
station.active(True)
station.connect(‘MicroPython-dbf032’, ‘micropythoN’)
while station.isconnected() == False:
pass
print(‘Connection successful’)
print(station.ifconfig())
led = Pin(2, Pin.OUT)
led.low()
Hi Sara,
Now when I try to download ‘boot.py’ to the device,
all I get is a Th popup:
Device is busy. can’t perform this action now
Please wait or cancel cu work and try again!
OK
—-There’s nothing a cad do now all fail.
Thanks,
Gary
Hi.
If the device is busy, it means you need to press the STOP button before trying to upload a new code.
Additionally, make sure the device is not opened in any other program.
Regards,
Sara
Thanks, I found some a ref that stopping with Stop and Ctrl-C, in the Python Window worked.
The code still does not run without problems.
Thanks Sara so much, Ill get back to you ASAP
I have been working on this now for 4 day!
Thanks you for you grace!!
Gary
Hi Sare,
I got Rui’s code to compile in Thommy with one missing: import socket in main.
When I go to http://192.168.1.148 it just hangs.
- 192.168.1.148/?led=on
- https://github.com/RuiSantosdotme/ESP-MicroPython/tree/master/code/WiFi/Web_Server_Output_Simple
Also when I run the code, shouldn’t the web page ring up?
Thanks,
Gary
Hi Sara,
Sorry Sara, not sure how to best edit my forum info
So sorry for the duplication, please advise me on best way to handle this, I deleted a bunch from my fist message.
- Now:
How to save to flash not Ram?
Got the Web app to work finally.
But it only seems to save to RAM, not flash.
2. PyCharm is still my goal, Thonny is very easy but also very limited.
What do you use?
Thanks,
Gary
Hi Gary.
I’ve just tested that example using uPyCraft and Thonny IDE and it is working fine.
Make sure you upload boot.py first, and then main.py. Make sure those two files are uploaded to the board. Otherwise, it will not work. If you’re having issues getting it working on two separate files, copy the content of the boot.py to the top of the main.py file and use just the main.py file.
I’m not familiar with PyCharm with MicroPython. I’m installing PyCharm at the moment, and if I get it right, I might create a tutorial about that.
To save data to flash, you need to set up a filesystem on the board (I’m not familiar with this on MicroPython).
Regards,
Sara