-
Notifications
You must be signed in to change notification settings - Fork 93
/
Copy pathArduino_using_GarageDoor_remote.ino
97 lines (82 loc) · 1.47 KB
/
Arduino_using_GarageDoor_remote.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
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE); // Set the LCD I2C address
const int VT = 2;
const int D0 = 6;
const int D1 = 5;
const int D2 = 4;
const int D3 = 3;
int transmitState = 0;
int button0State = 0;
int button1State = 0;
int button2State = 0;
int button3State = 0;
void setup()
{
// Setup size of LCD 20 characters and 2 lines
lcd.begin(20,2);
// Back light on
lcd.backlight();
pinMode(VT, INPUT);
pinMode(D0, INPUT);
pinMode(D1, INPUT);
pinMode(D2, INPUT);
pinMode(D3, INPUT);
lcd.setCursor(0,0);
lcd.clear();
}
void loop()
{
transmitState = digitalRead(VT);
if (transmitState == HIGH)
{
button0State = digitalRead(D0);
button1State = digitalRead(D1);
button2State = digitalRead(D2);
button3State = digitalRead(D3);
}
else
{
button0State = LOW;
button1State = LOW;
button2State = LOW;
button3State = LOW;
}
lcd.setCursor(0,0);
if (button0State == HIGH)
{
lcd.print("B0=On ");
}
else
{
lcd.print("B0=Off");
}
lcd.setCursor(7,0);
if (button1State == HIGH)
{
lcd.print("B1=On ");
}
else
{
lcd.print("B1=Off");
}
lcd.setCursor(0,1);
if (button2State == HIGH)
{
lcd.print("B2=On ");
}
else
{
lcd.print("B2=Off");
}
lcd.setCursor(7,1);
if (button3State == HIGH)
{
lcd.print("B3=On ");
}
else
{
lcd.print("B3=Off");
}
delay(10);
}