Skip to content

Commit 27aec61

Browse files
committed
Added unsafe_boot.py
1 parent 780933a commit 27aec61

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

PyPortal_CMA_Art_Frame/unsafe_boot.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import time
2+
import digitalio
3+
import storage
4+
import board
5+
6+
# Either of these should work for the PyPortal
7+
switch = digitalio.DigitalInOut(board.D4) # upper port
8+
#switch = digitalio.DigitalInOut(board.D3) # lower port
9+
10+
switch.direction = digitalio.Direction.INPUT
11+
switch.pull = digitalio.Pull.UP
12+
13+
# If the switch pin is connected to ground CircuitPython can write to the drive
14+
# Use a female/female jumper wire to connect the outer pins in the D4 connecter
15+
16+
storage.remount("/", disable_concurrent_write_protection= not switch.value)
17+
if switch.value:
18+
print("File system is read-only, insert jumper in data port between")
19+
print("pins 1 and 3 to make it writeable.")
20+
else:
21+
print("File system is writable, remove jumper in data port to make")
22+
print("it read-only and available to CircuitPython.")
23+
24+
time.sleep(5)

0 commit comments

Comments
 (0)