Diniati Ruaika
Published © CC BY

SMART BIKE LOCK

Smart bike lock adalah sebuah alat yang bertujuan untuk mengunci sebuah sepeda dengan menggunakan kontrol akses kunci biasa dan password

IntermediateWork in progress24 hours112
SMART BIKE LOCK

Things used in this project

Hardware components

Arduino UNO & Genuino UNO
Arduino UNO & Genuino UNO
×1
LED (generic)
LED (generic)
×2
Resistor 220 ohm
Resistor 220 ohm
×2
Breadboard (generic)
Breadboard (generic)
×1
Jumper wires (generic)
Jumper wires (generic)
×20
Servo
×1
keypad 4x4
×1
kawat besi/pegangan ember
×1

Software apps and online services

Arduino IDE
Arduino IDE

Story

Read more

Schematics

skema_smart_bike_lock_IP59RftEQL.fzz

Schematic smart bike lock

Breadboard smart bike lock

Code

SMART BIKE LOCK

C/C++
program ini dibuat untuk menjalankan kunci sepeda dengan menggunakan servo
#include <Keypad.h>  
 #include <Servo.h>  
 Servo servo_Motor;   
 char* password = "1234";  //boleh diganti kok
 int position = 0; 
 
 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'}
};
 byte rowPins[ROWS] = { 9, 8, 7, 6, };  
 byte colPins[COLS] = { 5, 4, 3,2 };  
 Keypad keypad = Keypad( makeKeymap(keys), rowPins, colPins, ROWS, COLS );  
 int redPin = 12;  
 int greenPin = 13; 
 int buzzer = 10; 
 void setup()  
 {pinMode(buzzer, OUTPUT);
 pinMode(redPin, OUTPUT);  
 pinMode(greenPin, OUTPUT);  
 servo_Motor.attach(11);  
 setLocked(true);  
 }  
 void loop()  
 {  
 char key = keypad.getKey();  
 if (key == '*' || key == '#')  
 {  
 position = 0;  
 setLocked(true);  
 }  
 if (key == password[position])  
 {  
 position ++;
  
 }  
 if (position == 4)  //position mau bikin sandi berapa digit
 {  
 setLocked(false);  
 }  
 delay(100);  
 }  
 void setLocked(int locked)  
 {  
 if (locked)  
 {  
 digitalWrite(redPin, HIGH); 

 digitalWrite(greenPin, LOW);  
 servo_Motor.write(11);
  
 }  
 else  
 {  
 digitalWrite(redPin, LOW); 
 
 digitalWrite(greenPin, HIGH);
  
 servo_Motor.write(180);  
 }  
 }  
//DiniatiRuaika15650011

Credits

Diniati Ruaika

Diniati Ruaika

1 project • 0 followers
Diniati Ruaika/15650011

Comments

Add projectSign up / Login