Giter VIP home page Giter VIP logo

pythonsb's Introduction

pythonSB

pythonSB (python Servo Blaster) is a python implementation of the Servo Blaster program. It's main purpose is to make it easier to control servos attached to your raspberry pi directly from python. It takes care of writing to the servo blaster file and allows you to set servo positions with a single function in python.

License

pythonSB is released under the GNU GPL v3 or later license for all to freely enjoy.

Installation

This python module requires you to have the Servo Blaster program installed and running. To to do so please follow these instructions:

  1. Grab the Servo Blaser repo form GitHub:

sudo apt-get install git

git clone https://github.com/richardghirst/PiBits.git

  1. Navigate to the program folder:

cd PiBits/ServoBlaster/user

  1. Now we need to install Servo Blaster:

sudo make install

Depending on what dev tools you already installed you might need some others. Open an issue on github if you need help.

Now that it is installed, servo blaster should be running. For reference, you can use the following:

sudo service servoblaster status to see the current status of servo blaster

sudo service servoblaster start to start servo blaster

sudo service servoblaster stop to stop servo blaster

You shouldn't have to manually start/stop it, it should start on boot automatically.

Usage

pythonSB is very easy to use. With just one small function you can control a servo on any GPIO pin that Servo Blaster supports. You can see an example of how to use it in the example.py file in this repo.

  1. Import the pythonSB module by doing this: from pythonSB import *

  2. Call the servo_set function like so: servo_set(12, "1500us")

  3. The example.py file has examples of different ways and explains how to use them.

FAQ

The servos aren't responding to any commands

If they are "slack" or have no resistance, have they got power? Please do NOT power them from the 5v rail on the pi. I know it's tempting and it may work for 1 or 2 servos but it is NOT good for the pi. Please use a separate battery or power supply. If you're still having problems open an issue on GitHub.

I get an error about importing pythonSB

You need to make sure that pythonSB.py is in the same folder as you're project. The easiest way is to download this entire GitHub repository and run the example.py program to see how it works.

It's still not working!

Open an issue on GitHub and I'll try to help out.

pythonsb's People

Contributors

jabelone avatar

Watchers

James Cloos avatar Tim You avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.