Skip to content

Commit

Permalink
Update code.py
Browse files Browse the repository at this point in the history
  • Loading branch information
porplax authored Apr 9, 2024
1 parent a9396c6 commit e8160d9
Showing 1 changed file with 17 additions and 19 deletions.
36 changes: 17 additions & 19 deletions src/neobridge/code.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,14 @@
import time
import json

SHOW = -3
RESET = -2
WAIT_FOR_RESPONSE = -1
class Command:
SHOW = -3
RESET = -2
WAIT_FOR_RESPONSE = -1

SET_ALL = 0
SET_ONE = 1
SET_LIST = 2
SET_ALL = 0
SET_ONE = 1
SET_TO_LIST = 2

PIXEL_PIN = board.GP15
NUMBER_OF_PIXELS = 30
Expand All @@ -38,26 +39,23 @@
try:
command = data['command']

if command == WAIT_FOR_RESPONSE:
if command == Command.SHOW:
neo.show()
elif command == Command.RESET:
print('\r\n')
supervisor.reload()
elif command == Command.WAIT_FOR_RESPONSE:
print('\r\n')
elif command == SET_ALL:
elif command == Command.SET_ALL:
r,g,b = data['r'],data['g'],data['b']
neo.fill((r,g,b))
elif command == SET_ONE:
elif command == Command.SET_ONE:
r,g,b = data['r'],data['g'],data['b']
i = data['index']
neo[i] = (r,g,b)
elif command == SHOW:
neo.show()
elif command == RESET:
print('\r\n')
supervisor.reload()
elif command == SET_LIST:
elif command == Command.SET_TO_LIST:
_list = data['rgb_list']
for i in _list:
for i in range(len(neo)):
neo[i] = _list[i]
except:
pass



0 comments on commit e8160d9

Please sign in to comment.