Adafruit PCA9685 PWM Library
Classes | Macros
Adafruit_PWMServoDriver.h File Reference
#include <Adafruit_I2CDevice.h>
#include <Arduino.h>

Go to the source code of this file.

Classes

class  Adafruit_PWMServoDriver
 Class that stores state and functions for interacting with PCA9685 PWM chip. More...
 

Macros

#define PCA9685_MODE1   0x00
 
#define PCA9685_MODE2   0x01
 
#define PCA9685_SUBADR1   0x02
 
#define PCA9685_SUBADR2   0x03
 
#define PCA9685_SUBADR3   0x04
 
#define PCA9685_ALLCALLADR   0x05
 
#define PCA9685_LED0_ON_L   0x06
 
#define PCA9685_LED0_ON_H   0x07
 
#define PCA9685_LED0_OFF_L   0x08
 
#define PCA9685_LED0_OFF_H   0x09
 
#define PCA9685_ALLLED_ON_L   0xFA
 
#define PCA9685_ALLLED_ON_H   0xFB
 
#define PCA9685_ALLLED_OFF_L   0xFC
 
#define PCA9685_ALLLED_OFF_H   0xFD
 
#define PCA9685_PRESCALE   0xFE
 
#define PCA9685_TESTMODE   0xFF
 
#define MODE1_ALLCAL   0x01
 
#define MODE1_SUB3   0x02
 
#define MODE1_SUB2   0x04
 
#define MODE1_SUB1   0x08
 
#define MODE1_SLEEP   0x10
 
#define MODE1_AI   0x20
 
#define MODE1_EXTCLK   0x40
 
#define MODE1_RESTART   0x80
 
#define MODE2_OUTNE_0   0x01
 
#define MODE2_OUTNE_1   0x02
 
#define MODE2_OUTDRV   0x04
 
#define MODE2_OCH   0x08
 
#define MODE2_INVRT   0x10
 
#define PCA9685_I2C_ADDRESS   0x40
 
#define FREQUENCY_OSCILLATOR   25000000
 
#define PCA9685_PRESCALE_MIN   3
 
#define PCA9685_PRESCALE_MAX   255
 

Detailed Description

This is a library for our Adafruit 16-channel PWM & Servo driver.

Designed specifically to work with the Adafruit 16-channel PWM & Servo driver.

Pick one up today in the adafruit shop! ---—> https://www.adafruit.com/product/815

These driver use I2C to communicate, 2 pins are required to interface. For Arduino UNOs, thats SCL -> Analog 5, SDA -> Analog 4.

Adafruit invests time and resources providing this open source code, please support Adafruit andopen-source hardware by purchasing products from Adafruit!

Limor Fried/Ladyada (Adafruit Industries).

BSD license, all text above must be included in any redistribution

Macro Definition Documentation

◆ PCA9685_MODE1

#define PCA9685_MODE1   0x00

Mode Register 1

◆ PCA9685_MODE2

#define PCA9685_MODE2   0x01

Mode Register 2

◆ PCA9685_SUBADR1

#define PCA9685_SUBADR1   0x02

I2C-bus subaddress 1

◆ PCA9685_SUBADR2

#define PCA9685_SUBADR2   0x03

I2C-bus subaddress 2

◆ PCA9685_SUBADR3

#define PCA9685_SUBADR3   0x04

I2C-bus subaddress 3

◆ PCA9685_ALLCALLADR

#define PCA9685_ALLCALLADR   0x05

LED All Call I2C-bus address

◆ PCA9685_LED0_ON_L

#define PCA9685_LED0_ON_L   0x06

LED0 on tick, low byte

◆ PCA9685_LED0_ON_H

#define PCA9685_LED0_ON_H   0x07

LED0 on tick, high byte

◆ PCA9685_LED0_OFF_L

#define PCA9685_LED0_OFF_L   0x08

LED0 off tick, low byte

◆ PCA9685_LED0_OFF_H

#define PCA9685_LED0_OFF_H   0x09

LED0 off tick, high byte

◆ PCA9685_ALLLED_ON_L

#define PCA9685_ALLLED_ON_L   0xFA

load all the LEDn_ON registers, low

◆ PCA9685_ALLLED_ON_H

#define PCA9685_ALLLED_ON_H   0xFB

load all the LEDn_ON registers, high

◆ PCA9685_ALLLED_OFF_L

#define PCA9685_ALLLED_OFF_L   0xFC

load all the LEDn_OFF registers, low

◆ PCA9685_ALLLED_OFF_H

#define PCA9685_ALLLED_OFF_H   0xFD

load all the LEDn_OFF registers,high

◆ PCA9685_PRESCALE

#define PCA9685_PRESCALE   0xFE

Prescaler for PWM output frequency

◆ PCA9685_TESTMODE

#define PCA9685_TESTMODE   0xFF

defines the test mode to be entered

◆ MODE1_ALLCAL

#define MODE1_ALLCAL   0x01

respond to LED All Call I2C-bus address

◆ MODE1_SUB3

#define MODE1_SUB3   0x02

respond to I2C-bus subaddress 3

◆ MODE1_SUB2

#define MODE1_SUB2   0x04

respond to I2C-bus subaddress 2

◆ MODE1_SUB1

#define MODE1_SUB1   0x08

respond to I2C-bus subaddress 1

◆ MODE1_SLEEP

#define MODE1_SLEEP   0x10

Low power mode. Oscillator off

◆ MODE1_AI

#define MODE1_AI   0x20

Auto-Increment enabled

◆ MODE1_EXTCLK

#define MODE1_EXTCLK   0x40

Use EXTCLK pin clock

◆ MODE1_RESTART

#define MODE1_RESTART   0x80

Restart enabled

◆ MODE2_OUTNE_0

#define MODE2_OUTNE_0   0x01

Active LOW output enable input

◆ MODE2_OUTNE_1

#define MODE2_OUTNE_1   0x02

Active LOW output enable input - high impedience

◆ MODE2_OUTDRV

#define MODE2_OUTDRV   0x04

totem pole structure vs open-drain

◆ MODE2_OCH

#define MODE2_OCH   0x08

Outputs change on ACK vs STOP

◆ MODE2_INVRT

#define MODE2_INVRT   0x10

Output logic state inverted

◆ PCA9685_I2C_ADDRESS

#define PCA9685_I2C_ADDRESS   0x40

Default PCA9685 I2C Slave Address

◆ FREQUENCY_OSCILLATOR

#define FREQUENCY_OSCILLATOR   25000000

Int. osc. frequency in datasheet

◆ PCA9685_PRESCALE_MIN

#define PCA9685_PRESCALE_MIN   3

minimum prescale value

◆ PCA9685_PRESCALE_MAX

#define PCA9685_PRESCALE_MAX   255

maximum prescale value