[API] Driver Servomotors - Thomas-Broussard/hackberry-enableFrance GitHub Wiki
class Hackberry_servos
Summary
| Members | Descriptions | 
|---|---|
| public  Hackberry_servos() | Constructor of the Servomotor Driver | 
| public void init(unsigned char indexPin,unsigned char thumbPin,unsigned char fingersPin) | Initialize the Servomotor driver | 
| public void setHand(bool selectedHand) | Set the hand used | 
| public bool getHand() | |
| public void changeHand() | Change the hand used (useful to change the servomotors direction) | 
| public void setSpeed(unsigned char speed) | Set the speed of the servomotors | 
| public unsigned char getSpeed() | Get the speed of the servomotors | 
| public void move(unsigned char member,int position,bool waitEnabled) | Move one of the members of the hand (Absolute move) | 
| public void relativeMove(unsigned char member,int degree,bool waitEnabled) | Move one of the members of the hand (Relative move) | 
| public void relativeOpen(unsigned char member,int degree,bool waitEnabled) | Open one of the members of the hand (Relative move) | 
| public void relativeClose(unsigned char member,int degree,bool waitEnabled) | Close one of the members of the hand (Relative move) | 
| public void open(unsigned char member) | Put one of the hand members to be in the open position | 
| public void close(unsigned char member) | Put one of the hand members to be in the closed position | 
| public void openAll() | Put the whole hand in open position | 
| public void closeAll() | Put the whole hand in closed position | 
| public void forceMove(unsigned char member,int position) | move one of the members of the hand (Absolute move) | 
| public void forceRelativeMove(unsigned char member,int position) | Force Move one of the members of the hand (Relative move) | 
| public void forceRelativeOpen(unsigned char member,int degree) | Force Open one of the members of the hand (Relative move) | 
| public void forceRelativeClose(unsigned char member,int degree) | Force Close one of the members of the hand (Relative move) | 
| public void setLimitPositions(unsigned char member,unsigned char limit1,unsigned char limit2) | Set the two limit positions of a servomotor as open and close position (depending on selected hand) | 
| public unsigned char getPosition(unsigned char member) | Get the last position of a servomotor | 
| public unsigned char getOpenPosition(unsigned char member) | Get the open position of a servomotor | 
| public unsigned char getClosePosition(unsigned char member) | Get the close position of a servomotor | 
| public void lockMember(unsigned char member) | Lock a member (the member can't move anymore) | 
| public void unlockMember(unsigned char member) | Unlock a member (the member can move) | 
Members
public  Hackberry_servos()
Constructor of the Servomotor Driver
public void init(unsigned char indexPin,unsigned char thumbPin,unsigned char fingersPin)
Initialize the Servomotor driver
Parameters
- 
indexPinDigital Output - Pin of Index servomotor
- 
thumbPinDigital Output - Pin of Thumb servomotor
- 
fingersPinDigital Output - Pin of Fingers servomotor
public void setHand(bool selectedHand)
Set the hand used
Parameters
- selectedHandtrue (RIGHT_HAND) or false (LEFT_HAND)
public bool getHand()
public void changeHand()
Change the hand used (useful to change the servomotors direction)
public void setSpeed(unsigned char speed)
Set the speed of the servomotors
Parameters
- speedspeed required (from 1 to 255)
public unsigned char getSpeed()
Get the speed of the servomotors
Returns
speed of servomotors (from 1 to 255)
public void move(unsigned char member,int position,bool waitEnabled)
Move one of the members of the hand (Absolute move)
Parameters
- 
membreMember to move (THUMB, INDEX or FINGERS)
- 
positionDesired position for the member
- 
waitEnabledtrue : wait the end of the move to do another action
public void relativeMove(unsigned char member,int degree,bool waitEnabled)
Move one of the members of the hand (Relative move)
Parameters
- 
membreMember to move (THUMB, INDEX or FINGERS)
- 
degreenumber of rotation degree (between -180 and 180°)
- 
waitEnabledtrue : wait the end of the move to do another action
public void relativeOpen(unsigned char member,int degree,bool waitEnabled)
Open one of the members of the hand (Relative move)
Parameters
- 
membreMember to move (THUMB, INDEX or FINGERS)
- 
degreenumber of rotation degree (between 0 and 180°)
- 
waitEnabledtrue : wait the end of the move to do another action
public void relativeClose(unsigned char member,int degree,bool waitEnabled)
Close one of the members of the hand (Relative move)
Parameters
- 
membreMember to move (THUMB, INDEX or FINGERS)
- 
degreenumber of rotation degree (between 0 and 180°)
- 
waitEnabledtrue : wait the end of the move to do another action
public void open(unsigned char member)
Put one of the hand members to be in the open position
Parameters
- memberMember to open (THUMB, INDEX or FINGERS)
public void close(unsigned char member)
Put one of the hand members to be in the closed position
Parameters
- memberMember to close (THUMB, INDEX or FINGERS)
public void openAll()
Put the whole hand in open position
public void closeAll()
Put the whole hand in closed position
public void forceMove(unsigned char member,int position)
move one of the members of the hand (Absolute move)
Parameters
- 
membreMember to move (THUMB, INDEX or FINGERS)
- 
positionDesired position for the member
- 
waitEnabledtrue : wait the end of the move to do another action
public void forceRelativeMove(unsigned char member,int position)
Force Move one of the members of the hand (Relative move)
Parameters
- 
membreMember to move (THUMB, INDEX or FINGERS)
- 
degreenumber of rotation degree (between -180 and 180°)
- 
waitEnabledtrue : wait the end of the move to do another action
public void forceRelativeOpen(unsigned char member,int degree)
Force Open one of the members of the hand (Relative move)
Parameters
- 
membreMember to move (THUMB, INDEX or FINGERS)
- 
degreenumber of rotation degree (between 0 and 180°)
- 
waitEnabledtrue : wait the end of the move to do another action
public void forceRelativeClose(unsigned char member,int degree)
Force Close one of the members of the hand (Relative move)
Parameters
- 
membreMember to move (THUMB, INDEX or FINGERS)
- 
degreenumber of rotation degree (between 0 and 180°)
- 
waitEnabledtrue : wait the end of the move to do another action
public void setLimitPositions(unsigned char member,unsigned char limit1,unsigned char limit2)
Set the two limit positions of a servomotor as open and close position (depending on selected hand)
Parameters
- memberMember required (THUMB, INDEX or FINGERS)
Returns
close position of the member
public unsigned char getPosition(unsigned char member)
Get the last position of a servomotor
Parameters
- memberMember required (THUMB, INDEX or FINGERS)
Returns
last position of the member
public unsigned char getOpenPosition(unsigned char member)
Get the open position of a servomotor
Parameters
- memberMember required (THUMB, INDEX or FINGERS)
Returns
open position of the member
public unsigned char getClosePosition(unsigned char member)
Get the close position of a servomotor
Parameters
- memberMember required (THUMB, INDEX or FINGERS)
Returns
close position of the member
public void lockMember(unsigned char member)
Lock a member (the member can't move anymore)
Parameters
- memberMember required (THUMB, INDEX or FINGERS)
public void unlockMember(unsigned char member)
Unlock a member (the member can move)
Parameters
- memberMember required (THUMB, INDEX or FINGERS)