Skip to content

Commit 828a46c

Browse files
authored
Merge pull request #5 from kattni/multiple-servo-examo
Adding multi-servo examples
2 parents 172e66f + 32f3804 commit 828a46c

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
"""Example that iterates through a servo on every channel, sets each to 180 and then back to 0."""
2+
import time
3+
from adafruit_servokit import ServoKit
4+
5+
# Set channels to the number of servo channels on your kit.
6+
# 8 for FeatherWing, 16 for Shield/HAT/Bonnet.
7+
kit = ServoKit(channels=8)
8+
9+
for i in range(len(kit.servo)):
10+
kit.servo[i].angle = 180
11+
time.sleep(1)
12+
kit.servo[i].angle = 0
13+
time.sleep(1)
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
"""Example that rotates servos on every channel to 180 and then back to 0."""
2+
import time
3+
from adafruit_servokit import ServoKit
4+
5+
# Set channels to the number of servo channels on your kit.
6+
# 8 for FeatherWing, 16 for Shield/HAT/Bonnet.
7+
kit = ServoKit(channels=8)
8+
9+
for i in range(len(kit.servo)):
10+
kit.servo[i].angle = 180
11+
time.sleep(1)
12+
for i in range(len(kit.servo)):
13+
kit.servo[i].angle = 0
14+
time.sleep(1)

0 commit comments

Comments
 (0)