Home
About Us
Achievement
Home
Raspberry-Pi Projects
_Raspberry Pi 4 Complete Guide
Arduino Project
_All Projects
Esp8266 Project
_All Projects
Esp32 Project
_Automation-with-feedback
Arduino And Keypad Based Timer
Just Do Electronics
November 06, 2020
Code :-
//Prateek //www.prateeks.in #include
#include
#define key1 6 #define key2 7 #define key3 9 #define key4 8 #define CLK 4 #define DIO 5 int Buzzer = 12; int ledPin = 11; #define TEST_DELAY 2000 TM1637Display display(CLK, DIO); void setup() { Serial.begin(9600); pinMode(key1, INPUT_PULLUP);// set pin as input pinMode(key2, INPUT_PULLUP);// set pin as input pinMode(key3, INPUT_PULLUP);// set pin as input pinMode(key4, INPUT_PULLUP);// set pin as input pinMode(ledPin, OUTPUT); pinMode(Buzzer, OUTPUT); } void loop() { int key1S = digitalRead(key1);// read if key1 is pressed int key2S = digitalRead(key2);// read if key1 is pressed int key3S = digitalRead(key3);// read if key1 is pressed int key4S = digitalRead(key4);// read if key1 is pressed // Code written for Robojax.com video Tutorial if (!key1S) { digitalWrite(ledPin, LOW); digitalWrite(Buzzer, HIGH); Serial.println("key 1 is pressed"); display.setBrightness(0x0f); uint8_t data[] = { 0x0, 0x0, 0x0, 0x0}; display.setSegments(data); for (int i = 10; i >= 0; i--) { display.showNumberDec(i); delay(1000); } digitalWrite(ledPin, HIGH); delay(3000); digitalWrite(ledPin, LOW); digitalWrite(Buzzer, LOW); display.clear(); } if (!key2S) { digitalWrite(ledPin, LOW); digitalWrite(Buzzer, HIGH); Serial.println("key 2 is pressed"); display.setBrightness(0x0f); uint8_t data[] = { 0x0, 0x0, 0x0, 0x0}; display.setSegments(data); for (int i = 20; i >= 0; i--) { display.showNumberDec(i); delay(1000); } digitalWrite(ledPin, HIGH); delay(3000); digitalWrite(ledPin, LOW); digitalWrite(Buzzer, LOW); display.clear(); } if (!key3S) { digitalWrite(ledPin, LOW); digitalWrite(Buzzer, HIGH); Serial.println("key 3 is pressed"); display.setBrightness(0x0f); uint8_t data[] = { 0x0, 0x0, 0x0, 0x0}; display.setSegments(data); for (int i = 30; i >= 0; i--) { display.showNumberDec(i); delay(1000); } digitalWrite(ledPin, HIGH); delay(3000); digitalWrite(ledPin, LOW); digitalWrite(Buzzer, LOW); display.clear(); } if (!key4S) { digitalWrite(ledPin, LOW); digitalWrite(Buzzer, HIGH); Serial.println("key 4 is pressed"); display.setBrightness(0x0f); uint8_t data[] = { 0x0, 0x0, 0x0, 0x0}; display.setSegments(data); for (int i = 40; i >= 0; i--) { display.showNumberDec(i); delay(1000); } digitalWrite(ledPin, HIGH); delay(3000); digitalWrite(ledPin, LOW); digitalWrite(Buzzer, LOW); display.clear(); } }
0 Comments
Newer
Older
ESP32 Interfacing With LDR Sensor
How To Make RFID & Keypad Based Door Lock
Ultrasonic Sensor as a Counter with Arduino
IoT Based Patient Health Monitoring System Using Blynk App
How to Make Gas Leak Detector & Auto Exhaust Fan Using Arduino
MLX90614 Non-Contact Infrared Thermometer With Arduino
Measure CO2 Level in Air Using Arduino
Esp32 Cam Based Face Unlock
ESP32 Led Blink With Push Button
Smart Street Light Using Arduino
YouTube
Like on Facebook
Follow on Twitter
Follow on Google+
Follow on Instagram
Subscribe on Youtube
Hi WelCome To My Website If you have a creative mind and want to learn Electronics even without studying it then FRIENDS this Website And Youtube Channel is for you, I am crazy creators who love making Electronics things. I have a bunch of more than 130 Tutorial Videos on My YouTube Channel and I upload a new Tutorial every Sunday.
Tags
Arduino Project
Esp32 Project
Esp8266 Project
0 Comments