-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathArduino_code.ino
More file actions
45 lines (39 loc) · 1003 Bytes
/
Arduino_code.ino
File metadata and controls
45 lines (39 loc) · 1003 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
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27, 16, 2);
String data_serial_receive;
const int relay = 13;
void setup() {
Serial.begin(57600);
pinMode(relay, OUTPUT);
digitalWrite(relay, HIGH);
lcd.init();
lcd.backlight();
lcd.setCursor(0, 0);
lcd.print("Face Recognition");
lcd.setCursor(5, 1);
lcd.print("System");
delay(2000);
}
void loop() {
if (Serial.available() > 0) {
data_serial_receive = Serial.readStringUntil('\n');
if(data_serial_receive == "1") {
digitalWrite(relay, LOW);
lcd.clear();
lcd.setCursor(1, 0);
lcd.print("WAJAH DIKENALI");
lcd.setCursor(1, 1);
lcd.print("Silahkan Masuk");
delay(100);
}
if(data_serial_receive == "0") {
digitalWrite(relay, HIGH);
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("Memindai Wajah..");
lcd.setCursor(0, 1);
lcd.print("Hadap ke kamera");
delay(100);
}
}
}