Home

Awesome

pypi version shield pypi downloads per month shield

Description

A micropython library to control rc servos in a tidy way.

This uses hardware PWM as an efficient way to generate the ouput signal. But therefore servos need to be connected to pins with PWM functionallity.

The servos can be calibrated using 2 points (min / max position). The default values should work for most servos, but won't set the servo to the exact position, as these values are different for each servo model.

Examples

Move servo

import time
from servo import Servo
my_servo = Servo(pin_id=28)
my_servo.write(30)
time.sleep(2.0)
my_servo.write(60)
time.sleep(2.0)
my_servo.write(90)

API

class Servo(pin_id,min_us=544.0,max_us=2400.0,min_deg=0.0,max_deg=180.0,freq=50)

write(deg)

read()

write_rad(rad)

read_rad()

write_us(us)

read_us()

off()