-
1Mount the storage as writable
Your circuit python board must have the storage mounted as writable in order for the save function in our editor to work. Serial, REPL, and loading code do not require this, but if you want to save the code back to the board it must be mounted. See details here: https://learn.adafruit.com/circuitpython-essentials/circuitpython-storage I've found it useful to have my boot.py script check the on-board switch and set the mode accordingly. Here is the code from my boot.py, you'll need to tweak it if you aren't using a Circuit Playground Express.
import board import digitalio import storage switch = digitalio.DigitalInOut(board.D7) switch.direction = digitalio.Direction.INPUT switch.pull = digitalio.Pull.UP # If the switch is flipped # CircuitPython can write to the drive storage.remount("/", switch.value)
Since boot.py only runs when the board powers on you must flip the switch while it's unpowered, then plug it in for the mounting to take effect.
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.