Skip to content

prestonsn/PCA9685-Multi-Channel-Servo-Controller-Driver-for-AVR-ATmega

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 

Repository files navigation

PCA9685-Multi-Channel-Servo-Controller-Driver-for-AVR-ATmega

Driver for the 32 channel servo controller. This library requires I2C functionality, the library used in this project can be found here: https://github.com/Preston-Sundar/AtmegaXX-I2C-Library

Example usage,

#include <avr/io.h>
#include <util/delay.h>
#include "pca9685.h"


int main(void)
{
    pca9685_init(0x00, 50); // start PCA9685 device 0x00 at 50 Hz output

    _delay_ms(5);

    int8_t angle = 0;

    pca9685_servo(0, 0);

    while (1) {
        pca9685_servo(0, 0); // set servo0 position to 0 degrees

        for (angle = -90; angle <= 90; angle += 5) {
            pca9685_servo(0, angle);
            _delay_ms(25);
        }

        for (angle = 90; angle >= -90; angle -= 5) {
            pca9685_servo(0, angle);
            _delay_ms(25);
        }
    }

    return 0;
}

About

PCA9685 driver for the ATmega series

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages