- Download as
.zip
from GitHub - Unzip and rename folder to
Tactor
- Place
Tactor
folder in yourArduino Libraries
folder - If needed rename the folder from
Tactor-main
toTactor
#include <Servo.h>
#include <Tactor.h>
Servo myServo;
Tactor myTactor;
in setup()
myServo.attach(pin);
myTactor.begin(Servo myServo, int frameTime, int initPos, int indicatorPin);
myServo
: Instance of Servo
pin
: pin to which servo motor is connected to
frameTime
: minimum update time between servo moves
initPos
: Initial position to start servo from
indicatorPin
: output pin for tactor activation status
myTactor.activate(); //activate the tactor
myTactor.deactivate(); //deactivate the tactor
myTactor.moveTo(int position, int duration);
myTactor.getCurrPos(); //returns current position (int)
position
: in degrees where tactor needs to move.
duration
: in what time tactor need to finish movement.(in ms)
myTactor.start(); //start the tactor
myTactor.stop(); //stop the tactor
myTactor.setDirection(bool direction); //true: towards, false: fromwards
myTactor.getDirection(); //returns direction (bool)
myTactor.hasArrived(); //has tactor arrived at its commaned move point?
myTactor.isRunning(); //is the tactor running (start/stop flag)
myTactor.update()