How to save to flash not Ram?
Got the Web app to work finally.
But it only seems to save to RAM, not flash.
- 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
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.
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()
# Complete project details at https://RandomNerdTutorials.com
import usocket as socket
from machine import Pin
ssid = ssid = ‘My local Network wifi’
password = ‘password for local Network’
station = network.WLAN(network.STA_IF)
while station.isconnected() == False:
led = Pin(2, Pin.OUT)
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!
—-There’s nothing a cad do now all fail.
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.
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.
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.
Also when I run the code, shouldn’t the web page ring up?
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).