Reiko Randoja / A3930
Embed: (wiki syntax)

« Back to documentation index

A3930 Class Reference

A3930 Class Reference

Class for controlling motors trough PCA9555. More...

#include <a3930.h>

Public Member Functions

 A3930 (PinName PWMpin, PCA9555 *ioExt, unsigned int dirPin, unsigned int brakePin, unsigned int coastPin, PinName tachoPin, PinName diroPin)
 Create an instance of the motor connected to specfied pins, and IO-expander.
void setSpeed (int newSpeed)
 Set speed setpoint.
int getSpeed ()
 Get current speed setpoint value.
void pid ()
 Method that calculates appropriate PWM values for keeping motor speed close to setpoint This method shoud be called periodically (60Hz)
void setPWM (float newPWM)
 Set pwm duty cycle.

Detailed Description

Class for controlling motors trough PCA9555.

Definition at line 9 of file a3930.h.


Constructor & Destructor Documentation

A3930 ( PinName  PWMpin,
PCA9555 *  ioExt,
unsigned int  dirPin,
unsigned int  brakePin,
unsigned int  coastPin,
PinName  tachoPin,
PinName  diroPin 
)

Create an instance of the motor connected to specfied pins, and IO-expander.

Parameters:
PWMpinPin for PWM output
*ioExtPointer to IO-expander object
dir1PinDirection pin 1 number (on IO-expander)
dir2PinDirection pin 2 number (on IO-expander)
encAEncoder pin
encBEncoder pin

Definition at line 3 of file a3930.cpp.


Member Function Documentation

int getSpeed (  )

Get current speed setpoint value.

Definition at line 71 of file a3930.cpp.

void pid (  )

Method that calculates appropriate PWM values for keeping motor speed close to setpoint This method shoud be called periodically (60Hz)

Definition at line 104 of file a3930.cpp.

void setPWM ( float  newPWM )

Set pwm duty cycle.

Parameters:
newPWMDuty cycle

Definition at line 49 of file a3930.cpp.

void setSpeed ( int  newSpeed )

Set speed setpoint.

Parameters:
newSpeedNew setpoint

Definition at line 97 of file a3930.cpp.