-
Notifications
You must be signed in to change notification settings - Fork 0
/
ArduSlidr.ino
59 lines (47 loc) · 1.14 KB
/
ArduSlidr.ino
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
57
58
59
/*
ArduSlidr
v0.03 David McGahan
17 Jan 2015
@dizymac
http://www.davidmcgahan.co.nz/ArduSlidr
*/
#include <AccelStepper.h>
AccelStepper drive;
const int startButton = 2; // Start button Pin
int startButtonStatus = 0;
const int resetButton = 3; // Stop and Reset button Pin
int resetButtonStatus = 0;
const int endStop = 4; // Pin for endstop
int endStopStatus = 0;
int shutterTrigger = 5; // Shutter trigger switch
int timeValue = 250; // delay between movement
void setup()
{
drive.setMaxSpeed(3000);
drive.setAcceleration(1000);
pinMode(startButton, INPUT);
pinMode(resetButton, INPUT);
pinMode(endStop, INPUT);
pinMode(shutterTrigger, OUTPUT);
}
void loop()
{
// read input value for Button pins
startButtonStatus = digitalRead(startButton);
resetButtonStatus = digitalRead(resetButton);
endStopStatus = digitalRead(endStop);
//start of loop
if (startButtonStatus == HIGH)
{
while(endStopStatus != HIGH)
{
for(int i=0; i < 10; i++)
{
drive(10500);
digitalWrite(shutterTrigger, HIGH);
delay(timeValue);
digitalWrite(shutterTrigger, LOW);
}
}
}
}