parent
79477c59e8
commit
cc67b2b657
|
@ -4,7 +4,10 @@
|
||||||
"python.analysis.extraPaths": [
|
"python.analysis.extraPaths": [
|
||||||
"",
|
"",
|
||||||
"c:\\Users\\ebbe.bass\\.vscode\\extensions\\joedevivo.vscode-circuitpython-0.1.20-win32-x64\\stubs",
|
"c:\\Users\\ebbe.bass\\.vscode\\extensions\\joedevivo.vscode-circuitpython-0.1.20-win32-x64\\stubs",
|
||||||
"c:\\Users\\ebbe.bass\\AppData\\Roaming\\Code\\User\\globalStorage\\joedevivo.vscode-circuitpython\\bundle\\20240326\\adafruit-circuitpython-bundle-py-20240326\\lib"
|
"c:\\Users\\ebbe.bass\\AppData\\Roaming\\Code\\User\\globalStorage\\joedevivo.vscode-circuitpython\\bundle\\20240602\\adafruit-circuitpython-bundle-py-20240602\\lib"
|
||||||
],
|
],
|
||||||
"circuitpython.board.version": null
|
"circuitpython.board.version": null,
|
||||||
|
"python.analysis.diagnosticSeverityOverrides": {
|
||||||
|
"reportMissingModuleSource": "none"
|
||||||
|
}
|
||||||
}
|
}
|
3
code.py
3
code.py
|
@ -35,13 +35,16 @@ def interpolate_color(encoder_pos):
|
||||||
|
|
||||||
fading_in_progress = False # Flag to indicate if fading animation is in progress
|
fading_in_progress = False # Flag to indicate if fading animation is in progress
|
||||||
|
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
enc_pos = encoder.position
|
enc_pos = encoder.position
|
||||||
enc_pos = min(max(enc_pos, -25), 25)
|
enc_pos = min(max(enc_pos, -25), 25)
|
||||||
|
print(enc_pos)
|
||||||
|
|
||||||
# Process button press
|
# Process button press
|
||||||
if not button.value and button_state is None:
|
if not button.value and button_state is None:
|
||||||
button_state = "pressed"
|
button_state = "pressed"
|
||||||
|
print("pressed")
|
||||||
elif button.value and button_state == "pressed":
|
elif button.value and button_state == "pressed":
|
||||||
lamp_state = not lamp_state # Toggle lamp state
|
lamp_state = not lamp_state # Toggle lamp state
|
||||||
button_state = None # Reset button state
|
button_state = None # Reset button state
|
||||||
|
|
Loading…
Reference in New Issue