initial commit
This commit is contained in:
0
.Trash-1000
Normal file
0
.Trash-1000
Normal file
0
.fseventsd/no_log
Normal file
0
.fseventsd/no_log
Normal file
0
.metadata_never_index
Normal file
0
.metadata_never_index
Normal file
15
.vscode/settings.json
vendored
Normal file
15
.vscode/settings.json
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
{
|
||||
"python.languageServer": "Pylance",
|
||||
"python.analysis.diagnosticSeverityOverrides": {
|
||||
"reportMissingModuleSource": "none",
|
||||
"reportShadowedImports": "none"
|
||||
},
|
||||
"circuitpython.board.version": "9.2.7",
|
||||
"circuitpython.board.vid": "0x239A",
|
||||
"circuitpython.board.pid": "0x80F4",
|
||||
"python.analysis.extraPaths": [
|
||||
"/home/mackan/.vscode/extensions/wmerkens.vscode-circuitpython-v2-0.3.3/boards/0x239A/0x80F4",
|
||||
"/home/mackan/.vscode/extensions/wmerkens.vscode-circuitpython-v2-0.3.3/stubs",
|
||||
"/home/mackan/.config/Code/User/globalStorage/wmerkens.vscode-circuitpython-v2/bundle/20250222/adafruit-circuitpython-bundle-py-20250222/lib"
|
||||
]
|
||||
}
|
||||
3
boot.py
Normal file
3
boot.py
Normal file
@@ -0,0 +1,3 @@
|
||||
import usb_cdc
|
||||
|
||||
usb_cdc.enable(console=True, data=True)
|
||||
4
boot_out.txt
Normal file
4
boot_out.txt
Normal file
@@ -0,0 +1,4 @@
|
||||
Adafruit CircuitPython 9.2.7 on 2025-04-01; Raspberry Pi Pico with rp2040
|
||||
Board ID:raspberry_pi_pico
|
||||
UID:504450612057BD1C
|
||||
boot.py output:
|
||||
31
code.py
Normal file
31
code.py
Normal file
@@ -0,0 +1,31 @@
|
||||
import time
|
||||
import board
|
||||
import usb_cdc
|
||||
import pwmio
|
||||
import digitalio
|
||||
|
||||
pwm_X = pwmio.PWMOut(board.GP17, frequency=1000, duty_cycle=0)
|
||||
pwm_Y = pwmio.PWMOut(board.GP18, frequency=1000, duty_cycle=0)
|
||||
pen = digitalio.DigitalInOut(board.GP16)
|
||||
pen.direction = digitalio.Direction.OUTPUT
|
||||
pen.value = False # Set pen to up position
|
||||
|
||||
def message_handler(msg):
|
||||
parts = msg.split(',')
|
||||
if len(parts) != 3:
|
||||
print("Invalid message format")
|
||||
return
|
||||
print(f"X: {parts[0]}, Y: {parts[1]}, Pen: {parts[2]}")
|
||||
pwm_X.duty_cycle = int(parts[0])
|
||||
pwm_Y.duty_cycle = int(parts[1])
|
||||
pen.value = True if int(parts[2]) == 1 else False
|
||||
|
||||
print("Booted")
|
||||
while True:
|
||||
if usb_cdc.data.in_waiting:
|
||||
data = usb_cdc.data.read(usb_cdc.data.in_waiting)
|
||||
message = data.decode('utf-8').strip()
|
||||
message_handler(message)
|
||||
time.sleep(0.5)
|
||||
usb_cdc.data.write(b"OK\n")
|
||||
time.sleep(0.1)
|
||||
1
sd/placeholder.txt
Normal file
1
sd/placeholder.txt
Normal file
@@ -0,0 +1 @@
|
||||
SD cards mounted at /sd will hide this file from Python. SD cards are not visible via USB CIRCUITPY.
|
||||
0
settings.toml
Normal file
0
settings.toml
Normal file
Reference in New Issue
Block a user