Skip to content

Commit

Permalink
Merge pull request #126 from logandgsmith/patch-1
Browse files Browse the repository at this point in the history
Update seesaw_quadrotary.py to change color of neopixel based on direction of rotation
  • Loading branch information
caternuson authored Feb 6, 2024
2 parents 262e47e + dad627c commit 3109848
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions examples/seesaw_quadrotary.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,6 @@
print(positions)
for n, rotary_pos in enumerate(positions):
if rotary_pos != last_positions[n]:
print(f"Rotary #{n}: {rotary_pos}")
last_positions[n] = rotary_pos

if switches[n].value: # Change the LED color if switch is not pressed
if (
rotary_pos > last_positions[n]
Expand All @@ -46,6 +43,9 @@
else:
colors[n] -= 8 # Advance backward through the colorwheel.
colors[n] = (colors[n] + 256) % 256 # wrap around to 0-256
# Set last position to current position after evaluating
print(f"Rotary #{n}: {rotary_pos}")
last_positions[n] = rotary_pos

# if switch is pressed, light up white, otherwise use the stored color
if not switches[n].value:
Expand Down

0 comments on commit 3109848

Please sign in to comment.