-
Notifications
You must be signed in to change notification settings - Fork 0
/
easyLinearStepper.h
executable file
·56 lines (46 loc) · 1.2 KB
/
easyLinearStepper.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
/*
* easyLinearStepper.h
*
* a library for controlling linear stepper actuators
*
* Author: Pedro A. Melendez
* email: [email protected]
*
*/
#ifndef EasyLinearStepper_H
#define EasyLinearStepper_H
#include "Arduino.h"
class linearStepper
{
private:
// arduino pins for controlling
unsigned short direction;
unsigned short enable;
unsigned short step;
unsigned short limit1;
unsigned short limit2;
// variables
double travelPerStep;
unsigned int period; // period between step in microseconds
unsigned int acceleration;
unsigned int minPeriod;
unsigned int maxPeriod;
inline void oneStep();
void accel();
void decel();
unsigned int spd2period(double);
public:
linearStepper(){}
~linearStepper(){}
void attach(unsigned short, unsigned short, unsigned short, double);
void move(const bool, double);
void moveLimit(const bool, double);
void moveConst(const bool, double);
void moveConst2Limit(const bool);
void setAccel(unsigned int);
void setLimit1(unsigned short);
void setLimit2(unsigned short);
void setMinSpeed(double);
void setMaxSpeed(double);
};
#endif