-
Notifications
You must be signed in to change notification settings - Fork 0
/
Code.ino
84 lines (81 loc) · 1.65 KB
/
Code.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
#include <LiquidCrystal.h>
#include <Servo.h>
#include "Keypad.h"
Servo s1,s2,s3,s4,s5,s6;
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
const byte ROWS = 4;
const byte COLS = 4;
char keys[ROWS][COLS] = {
{'1','2','3','A'},
{'4','5','6','B'},
{'7','8','9','C'},
{'*','0','#','D'}
};
void setup()
{
pinMode(6,OUTPUT);
pinMode(7,OUTPUT);
Serial.begin(9600);
s1.attach(9);
s1.attach(10);
s1.attach(11);
s1.attach(12);
s1.attach(13);
s1.attach(14);
lcd.begin(16, 2);
inputString.reserve(200);
}
void loop()
{
char x=Serial.read(keypad.getKey());
char p=Serial.read();
if(stringComplete)
{
Serial.println(inputString);
stringComplete = false;
if(x=='3')
{
s1.write(90);
delay(1000);
s1.write(0);
}
else if(x=='4')
{
s2.write(90);
delay(1000);
s2.write(0);
}
else if(x=='5')
{
s3.write(90);
delay(1000);
s3.write(0);
}
else if(x=='6')
{
s4.write(90);
delay(1000);
s4.write(0);
}
else if(x=='7')
{
s5.write(90);
delay(1000);
s5.write(0);
}
else if(x=='8')
{
s6.write(90);
delay(1000);
s6.write(0);
}
else
{
Serial.println("Invalid Size Enter Again");
}
}
else
{
Serial.println("Invalid User");
}
}