API for the PCA9685 16-channel, 12-bit PWM LED Controller.
More...
This controller is also used on the Adafruit* Motor Shield v2.3 board to control up to 4 DC motors, 2 stepper motors, and 2 servo motors.
This module was tested with the Adafruit Motor Shield v2.3
|
class | PCA9685_MODE1_T |
|
class | PCA9685_MODE2_T |
|
class | PCA9685_REG_T |
|
|
synchronized void | delete () |
|
| PCA9685 (int bus, short address, boolean raw) |
|
| PCA9685 (int bus, short address) |
|
| PCA9685 (int bus) |
|
boolean | writeByte (short reg, short arg1) |
|
boolean | writeWord (short reg, int word) |
|
short | readByte (short reg) |
|
int | readWord (short reg) |
|
boolean | setModeSleep (boolean sleep) |
|
boolean | ledFullOn (short led, boolean val) |
|
boolean | ledFullOff (short led, boolean val) |
|
boolean | ledOnTime (short led, int time) |
|
boolean | ledOffTime (short led, int time) |
|
boolean | setPrescale (short prescale) |
|
boolean | setPrescaleFromHz (float hz, float oscFreq) |
|
boolean | setPrescaleFromHz (float hz) |
|
void | enableRestart (boolean enabled) |
|
PCA9685 |
( |
int |
bus, |
|
|
short |
address, |
|
|
boolean |
raw |
|
) |
| |
PCA9685 constructor
- Parameters
-
bus | I2C bus to use |
address | Address for this device |
void enableRestart |
( |
boolean |
enabled | ) |
|
Enables or disables the restart capability of the controller
- Parameters
-
enabled | True to enable, false to disable It is enabled by default. |
boolean ledFullOff |
( |
short |
led, |
|
|
boolean |
val |
|
) |
| |
Sets or clears the FULL OFF bit for a given LED. If the FULL ON bit is also set, FULL OFF has precedence.
- Parameters
-
led | LED number; valid values are 0-15, PCA9685_ALL_LED |
val | True to set the bit, false to clear it |
- Returns
- True if successful
boolean ledFullOn |
( |
short |
led, |
|
|
boolean |
val |
|
) |
| |
Sets or clears the FULL ON bit for a given LED
- Parameters
-
led | LED number; valid values are 0-15, PCA9685_ALL_LED |
val | True to set the bit, false to clear it |
- Returns
- True if successful
boolean ledOffTime |
( |
short |
led, |
|
|
int |
time |
|
) |
| |
Sets the 'LED off' time (0-4,095). See the PCA9685 datasheet for details.
- Parameters
-
led | LED number; valid values are 0-15, PCA9685_ALL_LED |
time | 12-bit value at which point the LED turns off |
- Returns
- True if successful
boolean ledOnTime |
( |
short |
led, |
|
|
int |
time |
|
) |
| |
Sets the 'LED on' time (0-4,095). See the PCA9685 datasheet for details.
- Parameters
-
led | LED number; valid values are 0-15, PCA9685_ALL_LED |
time | 12-bit value at which point the LED turns on |
- Returns
- True if successful
short readByte |
( |
short |
reg | ) |
|
Reads a byte value from a register
- Parameters
-
reg | Register location to read from |
- Returns
- Value in a specified register
int readWord |
( |
short |
reg | ) |
|
Reads a word value from a register. Note: the device must have the auto-increment bit set in the MODE1 register to work.
- Parameters
-
reg | Register location to read from |
- Returns
- Value in a specified register
boolean setModeSleep |
( |
boolean |
sleep | ) |
|
Puts the device in or out of the sleep mode. The device is always in the sleep mode upon power-up.
- Parameters
-
sleep | True to put the device in the sleep mode, false to put out |
- Returns
- True if successful
boolean setPrescale |
( |
short |
prescale | ) |
|
Sets the prescale value. See the PCA9685 datasheet for details. The prescale can only be set when the device is in the sleep mode.
- Parameters
-
- Returns
- True if successful
boolean setPrescaleFromHz |
( |
float |
hz, |
|
|
float |
oscFreq |
|
) |
| |
Sets the prescale value based on a desired frequency in Hz. The prescale can only be set when the device is in the sleep mode.
- Parameters
-
hz | Desired frequency in Hz |
oscFreq | Oscillator frequency; default is 25 MHz |
- Returns
- True if successful
boolean writeByte |
( |
short |
reg, |
|
|
short |
arg1 |
|
) |
| |
Writes a byte value into a register
- Parameters
-
reg | Register location to write into |
byte | Byte to write |
- Returns
- True if successful
boolean writeWord |
( |
short |
reg, |
|
|
int |
word |
|
) |
| |
Writes a word value into a register. Note: the device must have the auto-increment bit set in the MODE1 register to work.
- Parameters
-
reg | Register location to write into |
word | Word to write |
- Returns
- True if successful
The documentation for this class was generated from the following file:
- /var/lib/jenkins/workspace/upm-doc-stable/build-33/src/pca9685/PCA9685.java