-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathHandServos.h
55 lines (47 loc) · 1.14 KB
/
HandServos.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
#ifndef HandServos_h
#define HandServos_h
#include "Arduino.h"
#include <ESP32Servo.h>
class HandServos
{
public:
HandServos(int);
Servo servoT;
Servo servoI;
Servo servoM;
Servo servoR;
String getValue;
void setupServos();
void calibrate();
void openFingers();
void openThumb();
void closeFingers();
void moveServos(String input, boolean freezeThumb);
void moveServos2(String input);
int var;
int interval;
private:
int pinT;
int pinI;
int pinM;
int pinR;
// Define number of pieces
const int numberOfPieces = 4;
String pieces[4];
String input = "";
// Keep track of current position in array
int counter = 0;
// Keep track of the last comma so we know where to start the substring
int lastIndex = 0;
int startPosT = 0;
int startPosI = 180;
int startPosM = 180;
int startPosR = 180;
int lastPosT = startPosT;
int lastPosI = startPosI;
int lastPosM = startPosM;
int lastPosR = startPosR;
int updateInterval; // interval between updates
unsigned long lastUpdate; // last update of position
};
#endif