Adafruit Circuit Playground + Crickit + Servos, with Micro/Circuit Python

Words
83
Reading
1 min
Listen
Play
8y

In the last project I simply lit up an LED and a Neopixel strip, here we look at using multiple Servos.

Adafruit simplify things by having a supplied Servo module, where we can supply an angle (or direction/speed if continuous 360 servos).

from adafruit_seesaw.seesaw import Seesaw
from adafruit_seesaw.pwmout import PWMOut
from adafruit_motor import servo
import board

The servo pins are the pins 17, 16, 15, 14, controlled via i2c via their "Seesaw" chip.

i2c = I2C(board.SCL, board.SDA)
seesaw = Seesaw(i2c)

As usual with Servos, we set the position with PWM (50 Hz).

# servo object
pwm = PWMOut(seesaw, 17)    
pwm.frequency = 50         
my_servo = servo.Servo(pwm) 

Once you have a servo object you can simply set it's position:

my_servo.angle = 90

Adafruit Circuit Playground + Crickit + Servos, with Micro/Circuit ... | Ecency