1
0
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:
Andrey Pokhilko 2019-09-07 23:10:50 +03:00
parent a6a5f12e6c
commit 13919d7ecc
2 changed files with 28 additions and 0 deletions

View File

@ -98,3 +98,13 @@ class BB8(object):
def _wait_loop(self): def _wait_loop(self):
while self._loop.is_running(): while self._loop.is_running():
time.sleep(0.001) 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)

View 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)