-
Notifications
You must be signed in to change notification settings - Fork 0
/
move_finger.cpp
33 lines (28 loc) · 941 Bytes
/
move_finger.cpp
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
/*
Movement Controller
Designed by: Bibaswan Bhawal
Version: 1.0
script to control finger movement
*/
#include "includes/move_finger.h"
/******************************************************************
* Function: moveFinger
*
* Description: Moves stepper motor by one step in given
* direction.
*
* Params:
* Finger finger: reference to a finger of type Finger
* int speed: speed at which to turn motor
* int direction: direction in which to turn motor
*
*****************************************************************/
void movefinger(Finger finger, int speed, int direction){
// Set rotation direction
digitalWrite(finger.dirPin, direction);
// rotate motor by one step
digitalWrite(finger.stepPin, HIGH);
delayMicroseconds(speed);
digitalWrite(finger.stepPin, LOW);
delayMicroseconds(speed);
}