akshaybaweja / Tactor

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Tactor

Install Guide

  • Download as .zip from GitHub
  • Unzip and rename folder to Tactor
  • Place Tactor folder in your Arduino Libraries folder
  • If needed rename the folder from Tactor-main to Tactor

API

Initialize Instance

#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

Activate/ Deactivate Tactor

myTactor.activate(); //activate the tactor

myTactor.deactivate(); //deactivate the tactor

Position Control

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)

Start/ Stop Tactor

myTactor.start(); //start the tactor

myTactor.stop(); //stop the tactor

Direction Control

myTactor.setDirection(bool direction); //true: towards, false: fromwards

myTactor.getDirection(); //returns direction (bool)

Checkpoints

myTactor.hasArrived(); //has tactor arrived at its commaned move point?

myTactor.isRunning(); //is the tactor running (start/stop flag)

Call this periodically in loop()

myTactor.update()

About

License:MIT License


Languages

Language:C++ 100.0%