Wyatt  1.0.1
Public Member Functions | List of all members
AdafruitPWMServoHat Class Reference

#include <AdafruitPWMServoHat.h>

Public Member Functions

 AdafruitPWMServoHat (int pwmFrequency=60)
 
 ~AdafruitPWMServoHat ()
 
bool setMotor (int motorID, int speed)
 
bool stopMotor (int motorID)
 
bool stopAllMotors ()
 
void setPwm (int channel, int on, int off)
 
void setAllPwm (int on, int off)
 

Detailed Description

This class controls an Adafruit PWM/Servo Raspberry Pi Hat.

I2C specific functions adapted from: https://github.com/adafruit/Adafruit_Python_PCA9685/blob/master/Adafruit_PCA9685/PCA9685.py

Definition at line 36 of file AdafruitPWMServoHat.h.

Constructor & Destructor Documentation

AdafruitPWMServoHat::AdafruitPWMServoHat ( int  pwmFrequency = 60)

Constructs an Adafruit PWM/Servo Driver Hat controller. This will also configure the proper I2C communication channels for the device.

Parameters
pwmFrequencyPWM frequency to set (default is 60)

Definition at line 7 of file AdafruitPWMServoHat.cpp.

AdafruitPWMServoHat::~AdafruitPWMServoHat ( )

Destruct the driver object.

Definition at line 23 of file AdafruitPWMServoHat.cpp.

Member Function Documentation

void AdafruitPWMServoHat::setAllPwm ( int  on,
int  off 
)

Set all PWM channels to a specific on/off time.

Parameters
onOn time
offOff time

Definition at line 81 of file AdafruitPWMServoHat.cpp.

bool AdafruitPWMServoHat::setMotor ( int  motorID,
int  speed 
)

Set a motor or servo on the HAT.

Parameters
motorIDMotor ID, from 0-15 (mapped to the outputs on the baord.
speedThe speed (0-4095) to set the motor to.
Returns
true if successful.

Definition at line 27 of file AdafruitPWMServoHat.cpp.

void AdafruitPWMServoHat::setPwm ( int  channel,
int  on,
int  off 
)

Set a PWM channel to a specific on/off time.

Parameters
channelChannel to write to.
onOn time
offOff time

Definition at line 73 of file AdafruitPWMServoHat.cpp.

bool AdafruitPWMServoHat::stopAllMotors ( )

Stop all motors on the HAT.

Returns
true if successful.

Definition at line 40 of file AdafruitPWMServoHat.cpp.

bool AdafruitPWMServoHat::stopMotor ( int  motorID)

Stop a specific motor/servo on the HAT.

Parameters
motorIDMotor ID, from 0-15 (mapped to the outputs on the baord.
Returns
true if successful.

Definition at line 34 of file AdafruitPWMServoHat.cpp.


The documentation for this class was generated from the following files: