-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathCoatingMachineManualFormula.ino
74 lines (65 loc) · 2.21 KB
/
CoatingMachineManualFormula.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
/*
Open Source Seed Coating Machine Controller
by Lot Amoros - Powerful Seeds
*/
// constants used here to set pin numbers:
const int buttonPin1 = 2; // the number of the pushbutton pin
const int buttonPin2 = 3; // the number of the pushbutton pin
const int buttonPin3 = 4; // the number of the pushbutton pin
const int RelayPin1 = 7; // enchufe
const int RelayPin2 = 8; // the number of the LED pin
const int RelayPin3 = 9; // the number of the LED pin
const int RelayPin4 = 10; // the number of the LED pin
const int RelayPin5 = 11; // the number of the LED pin
const int RelayPin6 = 12; // the number of the LED pin
// state of the buttons:
int buttonState1 = 0; // variable for reading the pushbutton status
int buttonState2 = 0; // variable for reading the pushbutton status
int buttonState3 = 0; // variable for reading the pushbutton status
void setup() {
// initialize the LED pin as an output:
pinMode(RelayPin1, OUTPUT);
pinMode(RelayPin2, OUTPUT);
pinMode(RelayPin3, OUTPUT);
pinMode(RelayPin4, OUTPUT);
pinMode(RelayPin5, OUTPUT);
pinMode(RelayPin6, OUTPUT);
// initialize the pushbutton pin as an input:
pinMode(buttonPin1, INPUT_PULLUP);
pinMode(buttonPin2, INPUT_PULLUP);
pinMode(buttonPin3, INPUT_PULLUP);
}
void loop() {
// read the state of the pushbutton value:
buttonState1 = digitalRead(buttonPin1);
buttonState2 = digitalRead(buttonPin2);
buttonState3 = digitalRead(buttonPin3);
// check if the pushbutton is pressed. If it is, the buttonState is HIGH:
if (buttonState1 == LOW) {
// turn LED on:
digitalWrite(RelayPin1, HIGH);
digitalWrite(RelayPin2, HIGH);
} else {
// turn LED off:
digitalWrite(RelayPin1, LOW);
digitalWrite(RelayPin2, LOW);
}
if (buttonState2 == LOW) {
// turn LED on:
digitalWrite(RelayPin3, HIGH);
digitalWrite(RelayPin4, HIGH);
} else {
// turn LED off:
digitalWrite(RelayPin3, LOW);
digitalWrite(RelayPin4, LOW);
}
if (buttonState3 == LOW) {
// turn LED on:
digitalWrite(RelayPin5, HIGH);
digitalWrite(RelayPin6, HIGH);
} else {
// turn LED off:
digitalWrite(RelayPin5, LOW);
digitalWrite(RelayPin6, LOW);
}
}