From 81ec22b354653d6bff9b18a50f96e9c2c60431b6 Mon Sep 17 00:00:00 2001 From: Dave Astels Date: Sun, 14 Oct 2018 16:21:44 -0400 Subject: [PATCH] Switch from simpleio to adafruit_motor for servos --- Sound_Reactive_Ears/code.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/Sound_Reactive_Ears/code.py b/Sound_Reactive_Ears/code.py index 61de3e861..16265117e 100644 --- a/Sound_Reactive_Ears/code.py +++ b/Sound_Reactive_Ears/code.py @@ -17,7 +17,8 @@ import math import array import board import audiobusio -import simpleio +import pulseio +from adafruit_motor import servo from adafruit_circuitplayground.express import cpx # Exponential scaling factor. @@ -30,9 +31,11 @@ NUM_SAMPLES = 90 # the trigger threshhold THRESHOLD = 6 +left_pwm = pulseio.PWMOut(board.A1, frequency=50) +right_pwm = pulseio.PWMOut(board.A2, frequency=50) -left_ear = simpleio.Servo(board.A1) -right_ear = simpleio.Servo(board.A2) +left_ear = servo.Servo(left_pwm) +right_ear = servo.Servo(right_pwm) cpx.pixels.fill((0, 0, 0)) left_ear.angle = 0