Notes
Notes - notes.io |
#include <Wire.h>
#include <LCD.h>
#include <LiquidCrystal_I2C.h>
#define I2C_ADDR 0x3f // LCD i2c Adress and pins
#define BACKLIGHT_PIN 3
#define En_pin 2
#define Rw_pin 1
#define Rs_pin 0
#define D4_pin 4
#define D5_pin 5
#define D6_pin 6
#define D7_pin 7
LiquidCrystal_I2C lcd(I2C_ADDR,En_pin,Rw_pin,Rs_pin,D4_pin,D5_pin,D6_pin,D7_pin);
const byte numRows= 4; //number of rows on the keypad
const byte numCols= 4; //number of columns on the keypad
int rakamsayac = 0;
int code = 1; //The code I used, you can change it
int code1 = 2;
int code2 = 3;
int code3 = 4;
int code4 = 5;
int code5 = 6;
int code6 = 7;
int code7 = 8;
int code8 = 9;
int tot,i1,i2,i3,i4;
char c1,c2,c3,c4;
//keymap defines the key pressed according to the row and columns just as appears on the keypad
char keymap[numRows][numCols]=
{
{'1', '2', '3', 'A'},
{'4', '5', '6', 'B'},
{'7', '8', '9', 'C'},
{'*', '0', '#', 'D'}
};
//Code that shows the the keypad connections to the arduino terminals
byte rowPins[numRows] = {9,8,7,6}; //Rows 0 to 3
byte colPins[numCols]= {5,4,3,2}; //Columns 0 to 3
//initializes an instance of the Keypad class
Keypad myKeypad= Keypad(makeKeymap(keymap), rowPins, colPins, numRows, numCols);
void setup()
{
lcd.begin (16,2);
lcd.setBacklightPin(BACKLIGHT_PIN,POSITIVE);
lcd.setBacklight(HIGH);
lcd.home ();
lcd.print("Kimya Gorevi");
lcd.setCursor(9, 1);
lcd.print("Umutcan");
delay(2000);
}
void loop()
{
char keypressed = myKeypad.getKey(); //The getKey fucntion keeps the program runing, as long you didn't press "*" the whole thing bellow wouldn't be triggered
if (keypressed == '*') // and you can use the rest of you're code simply
{
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("Sayi Giriniz"); //when the "*" key is pressed you can enter the passcode
if (keypressed != NO_KEY && rakamsayac == 0) //Birinci rakama basıldı
{
c1 = keypressed;
lcd.setCursor(0, 1);
lcd.print(c1);
rakamsayac = 1;
}
if((keypressed == "#") && (rakamsayac == 1)){
i1=c1-48;
tot = i1;
}
if (keypressed != NO_KEY && rakamsayac == 1)
{
c2 = keypressed;
lcd.setCursor(1, 1);
lcd.print(c2);
rakamsayac=2;
}
if((keypressed == "#") && (rakamsayac == 2)){
i1=(c1-48)*10;
i2=c2-48;
tot=i1+i2;
}
if (tot == code) //if the code is correct you trigger whatever you want here it just print a message on the screen
{
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("Hidrojen");
lcd.setCursor(0, 1);
lcd.print("Atom NumarasI 1");
delay(3000);
lcd.clear();
lcd.print("Sembolu");
lcd.setCursor(9, 1);
lcd.print("H");
delay(3000);
}
if (tot == code1) //if the code is correct you trigger whatever you want here it just print a message on the screen
{
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("Helyum");
lcd.setCursor(0, 1);
lcd.print("Atom NumarasI 2");
delay(3000);
lcd.clear();
lcd.print("Sembolu");
lcd.setCursor(9, 1);
lcd.print("He");
delay(3000);
}
if (tot == code2) //if the code is correct you trigger whatever you want here it just print a message on the screen
{
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("Lityum");
lcd.setCursor(0, 1);
lcd.print("Atom NumarasI 3");
delay(3000);
lcd.clear();
lcd.print("Sembolu");
lcd.setCursor(9, 1);
lcd.print("Li");
delay(3000);
}
if (tot == code3) //if the code is correct you trigger whatever you want here it just print a message on the screen
{
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("Berilyum");
lcd.setCursor(0, 1);
lcd.print("Atom NumarasI 4");
delay(3000);
lcd.clear();
lcd.print("Sembolu");
lcd.setCursor(9, 1);
lcd.print("Be");
delay(3000);
}
if (tot == code4) //if the code is correct you trigger whatever you want here it just print a message on the screen
{
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("Bor");
lcd.setCursor(0, 1);
lcd.print("Atom NumarasI 5");
delay(3000);
lcd.clear();
lcd.print("Sembolu");
lcd.setCursor(9, 1);
lcd.print("B");
delay(3000);
}
if (tot == code5) //if the code is correct you trigger whatever you want here it just print a message on the screen
{
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("Karbon");
lcd.setCursor(0, 1);
lcd.print("Atom NumarasI 6");
delay(3000);
lcd.clear();
lcd.print("Sembolu");
lcd.setCursor(9, 1);
lcd.print("C");
delay(3000);
}
if (tot == code6) //if the code is correct you trigger whatever you want here it just print a message on the screen
{
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("Azot");
lcd.setCursor(0, 1);
lcd.print("Atom NumarasI 7");
delay(3000);
lcd.clear();
lcd.print("Sembolu");
lcd.setCursor(9, 1);
lcd.print("N");
delay(3000);
}
if (tot == code7) //if the code is correct you trigger whatever you want here it just print a message on the screen
{
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("Oksijen");
lcd.setCursor(0, 1);
lcd.print("Atom NumarasI 8");
delay(3000);
lcd.clear();
lcd.print("Sembolu");
lcd.setCursor(9, 1);
lcd.print("O");
delay(3000);
}
if (tot == code8) //if the code is correct you trigger whatever you want here it just print a message on the screen
{
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("Flor");
lcd.setCursor(0, 1);
lcd.print("Atom NumarasI 9");
delay(3000);
lcd.clear();
lcd.print("Sembolu");
lcd.setCursor(9, 1);
lcd.print("F");
delay(3000);
}
else //if the code is wrong you get another thing
{
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("Baska Sayi Seciniz");
delay(2500);
lcd.clear();
lcd.print("YIldIza");
lcd.setCursor(9, 1);
lcd.print("BasInIz");
}
}
}
|
Notes.io is a web-based application for taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000 notes created and continuing...
With notes.io;
- * You can take a note from anywhere and any device with internet connection.
- * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
- * You can quickly share your contents without website, blog and e-mail.
- * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
- * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.
Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.
Easy: Notes.io doesn’t require installation. Just write and share note!
Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )
Free: Notes.io works for 12 years and has been free since the day it was started.
You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;
Email: [email protected]
Twitter: http://twitter.com/notesio
Instagram: http://instagram.com/notes.io
Facebook: http://facebook.com/notesio
Regards;
Notes.io Team