We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents d26c82a + 56d948c commit 647be29Copy full SHA for 647be29
AutoSunglasses/code.py
@@ -14,13 +14,15 @@
14
15
import time
16
import board
17
-import simpleio
+import pulseio
18
from adafruit_circuitplayground.express import cpx
19
+from adafruit_motor import servo
20
-servo = simpleio.Servo(board.A1)
21
+pwm = pulseio.PWMOut(board.A1, duty_cycle=2 ** 15, frequency=50)
22
+my_servo = servo.Servo(pwm)
23
24
cpx.pixels.fill((0, 0, 0))
-servo.angle = 90
25
+my_servo.angle = 90
26
27
while True:
28
light_level = cpx.light
@@ -30,8 +32,8 @@
30
32
else:
31
33
34
if light_level < 200:
- servo.angle = 90
35
+ my_servo.angle = 90
36
- servo.angle = 0
37
+ my_servo.angle = 0
38
39
time.sleep(0.25)
0 commit comments