Skip to content

didix21/servopi

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

servopi

Build Status

Table of Contents

Overview

This Python package contains a tool that allows to control servo motors in raspberry pi. You can define a servo motor in a easy way without worrying about setting the raspberry pi PWM. Moreover, you can move your servo motor using angles.

Features

  • Set a servo pin.
  • Move using angles.
  • Move using duty cycle.

Installation

    $ pip install servopi

Examples

Example 1

Define a SG90 servo model.

from servopi import Servo


def main():

    GPIO.setmode(GPIO.BOARD)
    angle = 120
    my_servo = Servo(11, "Sg90")
    my_servo.write_angle(angle)
    print("Moving: ", angle)


if __name__ == "__main__":

    main()

Example 2

from servopi import Servo


angle = 120
rasberry_pin = 11
frequency = 50
max_angle = 180
min_pulse_width = 0.5


def main():

    GPIO.setmode(GPIO.BOARD)
   
    my_servo = Servo(11, "myown", (frequency, max_angle, min_pulse_width))
    my_servo.write_angle(angle)
    print("Moving: ", angle)


if __name__ == "__main__":

    main()

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages