-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathRelay_Module.ino
More file actions
62 lines (41 loc) · 935 Bytes
/
Relay_Module.ino
File metadata and controls
62 lines (41 loc) · 935 Bytes
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
#include <Wire.h>
// Pin Definitions
const int DIGI_Wheel = PB4;
const int DIGI_Arm = PB3;
const int DIGI_Collection = PA15;
// Relay Class
class Relay {
private:
int pin;
public:
Relay(int pin) : pin(pin) {
pinMode(pin, OUTPUT);
digitalWrite(pin, LOW);
}
void turnOn() {
digitalWrite(pin, HIGH);
}
void turnOff() {
digitalWrite(pin, LOW);
}
};
// Relay Objects
Relay wheelRelay(DIGI_Wheel);
Relay armRelay(DIGI_Arm);
Relay collectionRelay(DIGI_Collection);
void setup() {
}
void loop() {
wheelRelay.turnOn();
delay(1000);
wheelRelay.turnOff();
delay(1000);
armRelay.turnOn();
delay(1000);
armRelay.turnOff();
delay(1000);
collectionRelay.turnOn();
delay(1000);
collectionRelay.turnOff();
delay(1000);
}