mirror of
https://github.com/undera/pylgbst.git
synced 2020-11-18 19:37:26 -08:00
Restoring bb8 connection
This commit is contained in:
parent
a6a5f12e6c
commit
13919d7ecc
@ -98,3 +98,13 @@ class BB8(object):
|
||||
def _wait_loop(self):
|
||||
while self._loop.is_running():
|
||||
time.sleep(0.001)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
bb8 = BB8()
|
||||
bb8.color(255, 0, 0)
|
||||
time.sleep(1)
|
||||
bb8.color(0, 255, 0)
|
||||
time.sleep(1)
|
||||
bb8.color(0, 0, 255)
|
||||
time.sleep(1)
|
||||
|
18
examples/bb8joystick/program.py
Normal file
18
examples/bb8joystick/program.py
Normal file
@ -0,0 +1,18 @@
|
||||
import time
|
||||
|
||||
from examples.bb8joystick import BB8, Joystick
|
||||
|
||||
bb8 = BB8()
|
||||
|
||||
|
||||
def button(p):
|
||||
print(p)
|
||||
if p == True:
|
||||
bb8.color(255, 255, 255)
|
||||
else:
|
||||
bb8.color(0, 0, 0)
|
||||
|
||||
|
||||
deck = Joystick()
|
||||
deck.on_button(button)
|
||||
time.sleep(60)
|
Loading…
x
Reference in New Issue
Block a user