Skip to content

Commit 301ceaf

Browse files
authored
Create specific_servo_parameter
From a beginners perspective: I just spend an hour to test my newest servo. Filling my gabs with the documentation at http://micropython-pca9685.readthedocs.io/en/latest/index.html#. From my point of view it would be easier to have a more specific example plus the simpletest.py This is may unesseary for advanched users, but very helpfull for bloody noobs like me.
1 parent 0ffe9af commit 301ceaf

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

examples/specific_servo_parameter

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import time
2+
3+
from board import *
4+
import busio
5+
6+
# Import the PCA9685 servo module.
7+
from adafruit_pca9685 import servo
8+
9+
10+
# Create the I2C bus interface.
11+
i2c = busio.I2C(SCL, SDA)
12+
13+
# Create a specific PCA9685 class instance, for example digital servos.
14+
# Specs of the Servo used:
15+
# Working Frequence: 1520us/333Hz, 900-2100us
16+
# Operating Voltage: DC 3.8V-8.4V
17+
# Speed:0.18sec/60@°3.8V 0.15sec/60°@6.0V 0.09sec/60°@8.4V
18+
# The address reflects the default address, if your change your adress through soldering
19+
# (See Adafruit Tutorial on 8-Channel PWM or Servo FeatherWing - Advanche use) change it.
20+
servos = servo.Servos(i2c, address=0x40, freq=333, min_us=900, max_us=2100, degrees=120)
21+
22+
# Loop forever moving servo 3 between its extremes.
23+
# Replace the servo number 3 with the number printed on your 8-Channel PWM or Servo​ FeatherWing
24+
while True:
25+
servos.position(3, us=900) # 900us period is one extreme
26+
time.sleep(1)
27+
servos.position(3, us=2100) # 2100us period is opposite extreme
28+
time.sleep(1)

0 commit comments

Comments
 (0)