Giter VIP home page Giter VIP logo

python_pca9685's Introduction

PCA9685-smbus2

A probably definitely not-best-practices way to use the PCA9685 with an Orange Pi Zero 3.

If it works, it works.

Purpose

This library replaces adafruit/Adafruit_Python_PCA9685 for the Orange Pi Zero 3 and presumably other single board computers that may or may not have reliable Blinka support.

Usage

This will set an SG90 micro servo plugged into channel 0 to spin to the -90° position.

from PCA9685_smbus2 import PCA9685

pwm = PCA9685.PCA9685() # defaults to using i2c-3 and address 0x40
pwm.set_pwm_freq(50) # set frequency to 50 Hz for SG90 servos

pwm.set_pwm(0, 0, 102) # channel 0, on time 0?, off time 102 (1 ms)

The on and off times above are the number of ticks on the PCA9685, which has a 12-bit resolution and therefore can range from 0 to 4096.

Tested on

This library has been tested on:

  • Orange Pi Zero 3

It likely supports any board in which the accessible I2C bus can be found by running ls /dev/i2c-*, since it relies on the smbus2 library for I2C interfacing.

Ensure that the relevant I2C interface has been enabled in sudo orangepi-config or sudo raspi-config (or whatever the case may be) for this to work right.

python_pca9685's People

Contributors

caternuson avatar picoplanetdev avatar tdicola avatar

Stargazers

 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.