-
Notifications
You must be signed in to change notification settings - Fork 25
/
openmms_intervalometer.ino
121 lines (113 loc) · 4.83 KB
/
openmms_intervalometer.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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
/*##########################################################################
# OpenMMS Camera Intervalometer Firmware #
############################################################################
# Version: 1.3 #
# Date: June 2020 #
# Author: Ryan Brazeal #
# Email: ryan.brazeal@ufl.edu #
# #
# OPEN-SOURCE LICENSE INFO: #
# #
# This file is part of OpenMMS_OSS. #
# #
# OpenMMS_OSS is free software: you can redistribute it and/or modify #
# it under the terms of the GNU General Public License as published by #
# the Free Software Foundation, either version 3 of the License, or #
# (at your option) any later version. #
# #
# OpenMMS_OSS is distributed in the hope that it will be useful, #
# but WITHOUT ANY WARRANTY; without even the implied warranty of #
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
# GNU General Public License for more details. #
# #
# You should have received a copy of the GNU General Public License #
# along with OpenMMS_OSS. If not, see <https://www.gnu.org/licenses/>. #
# #
############################################################################
# Updates: #
# April 2019 - Removed 100msec from each of the final delay commands in #
# order to account for the ~100msec of internal processing #
# time needed #
# #
# May 2020 - Updated intervals #
##########################################################################*/
int inputPin1 = 9;
int inputPin2 = 10;
int inputPin3 = 11;
int cameraPin = 13;
int input1Value = 0;
int input2Value = 0;
int input3Value = 0;
int signal_duration = 700;
void setup() {
pinMode(inputPin1, INPUT_PULLUP);
pinMode(inputPin2, INPUT_PULLUP);
pinMode(inputPin3, INPUT_PULLUP);
pinMode(cameraPin, OUTPUT);
}
//allow 100 msec for internal processing (recursively for each additionally second of delay) before next trigger pulse is sent, keeps the intervals closer to proper values
void loop() {
input1Value = digitalRead(inputPin1);
input2Value = digitalRead(inputPin2);
input3Value = digitalRead(inputPin3);
if (input1Value == LOW && input2Value == LOW && input3Value == LOW)
{
//Binary = 0, 1.5 second interval
digitalWrite(cameraPin,HIGH);
delay(signal_duration);
digitalWrite(cameraPin,LOW);
delay(750);
}
else if (input1Value == HIGH && input2Value == LOW && input3Value == LOW)
{
//Binary = 1, 2 second interval
digitalWrite(cameraPin,HIGH);
delay(signal_duration);
digitalWrite(cameraPin,LOW);
delay(1200);
}
else if (input1Value == LOW && input2Value == HIGH && input3Value == LOW)
{
//Binary = 2, 2.5 second interval
digitalWrite(cameraPin,HIGH);
delay(signal_duration);
digitalWrite(cameraPin,LOW);
delay(1650);
}
else if (input1Value == HIGH && input2Value == HIGH && input3Value == LOW)
{
//Binary = 3, 3 second interval
digitalWrite(cameraPin,HIGH);
delay(signal_duration);
digitalWrite(cameraPin,LOW);
delay(2100);
}
else if (input1Value == LOW && input2Value == LOW && input3Value == HIGH)
{
//Binary = 4, 3.5 second interval
digitalWrite(cameraPin,HIGH);
delay(signal_duration);
digitalWrite(cameraPin,LOW);
delay(2550);
}
else if (input1Value == HIGH && input2Value == LOW && input3Value == HIGH)
{
//Binary = 5, 4 second interval
digitalWrite(cameraPin,HIGH);
delay(signal_duration);
digitalWrite(cameraPin,LOW);
delay(3000);
}
else if (input1Value == LOW && input2Value == HIGH && input3Value == HIGH)
{
//Binary = 6, 5 second interval
digitalWrite(cameraPin,HIGH);
delay(signal_duration);
digitalWrite(cameraPin,LOW);
delay(3900);
}
else if (input1Value == HIGH && input2Value == HIGH && input3Value == HIGH)
{
//Binary = 7, DO NOTHING/REST STATE
}
}