Skip to content

Commit d9c84cf

Browse files
committed
Add Bluedot arm demos.
1 parent c762745 commit d9c84cf

File tree

2 files changed

+74
-0
lines changed

2 files changed

+74
-0
lines changed

demos/bluedot/led_only.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
from bluedot import BlueDot
2+
from signal import pause
3+
import usb_arm
4+
5+
arm = usb_arm.Arm()
6+
7+
def led_pressed(pos):
8+
arm.tell(usb_arm.LedOn)
9+
10+
def stop(*args):
11+
arm.tell(usb_arm.Stop)
12+
13+
bd = BlueDot(cols=3, rows=2)
14+
led = bd[1, 0]
15+
16+
bd.when_released = stop
17+
led.when_pressed = led_pressed
18+
bd.when_client_disconnects = stop
19+
pause()

demos/bluedot/simple_grid.py

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
from bluedot import BlueDot
2+
from signal import pause
3+
import usb_arm
4+
5+
arm = usb_arm.Arm()
6+
7+
def led_pressed(pos):
8+
arm.tell(usb_arm.LedOn)
9+
10+
11+
def stop(*args):
12+
arm.tell(usb_arm.Stop)
13+
14+
15+
def grip_pressed(pos):
16+
if pos.top:
17+
arm.tell(usb_arm.GripsClose)
18+
if pos.bottom:
19+
arm.tell(usb_arm.GripsOpen)
20+
21+
22+
def wrist_pressed(pos):
23+
if pos.top:
24+
arm.tell(usb_arm.WristUp)
25+
if pos.bottom:
26+
arm.tell(usb_arm.WristDown)
27+
28+
29+
def elbow_pressed(pos):
30+
if pos.top:
31+
arm.tell(usb_arm.ElbowUp)
32+
if pos.bottom:
33+
arm.tell(usb_arm.ElbowDown)
34+
35+
36+
def shoulder_pressed(pos):
37+
if pos.top:
38+
arm.tell(usb_arm.ShoulderUp)
39+
if pos.bottom:
40+
arm.tell(usb_arm.ShoulderDown)
41+
42+
43+
def base_pressed(pos):
44+
if pos.left:
45+
arm.tell(usb_arm.BaseCtrClockWise)
46+
if pos.right:
47+
arm.tell(usb_arm.BaseClockWise)
48+
49+
bd = BlueDot(cols=3, rows=2)
50+
led = bd[1, 0]
51+
52+
bd.when_released = stop
53+
led.when_pressed = led_pressed
54+
bd.when_client_disconnects = stop
55+
pause()

0 commit comments

Comments
 (0)