Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <Wire.h>
- #include <LCD.h>
- #include <LiquidCrystal_I2C.h>
- LiquidCrystal_I2C lcd(0x3F,2,1,0,4,5,6,7,3, POSITIVE);
- const int PIN_SDA = A4;
- const int PIN_SCL = A5;
- int switch1 = 6;
- int switch2 = 5;
- int counter = 0;
- int counter1 = 0;
- int button1 = 0;
- int lastButton1 = 0;
- int button2 = 0;
- int lastButton2 = 0;
- void setup()
- {
- lcd.begin (16,2);}
- void loop()
- {
- button1 = digitalRead(switch1);
- button2 = digitalRead(switch2);
- if (button1 != lastButton1)
- {
- if (button1 == HIGH)
- {
- int i;
- lcd.setBacklight(HIGH);
- lcd.setCursor(0,0);
- lcd.backlight();
- lcd.print("MUZAFFAR FARHAN");
- lcd.scrollDisplayRight();
- delay(100);
- lcd.setCursor(0,1);
- lcd.print("YOUTUBE CHANNEL");
- for (i = 0 ; i < 16; i ++) {
- lcd.scrollDisplayLeft();
- delay(200);
- lcd.setBacklight(HIGH);
- }
- }
- else
- {
- Serial.println("OFF");
- }
- delay(10);
- }
- if (button2 != lastButton2)
- {
- if (button2 == HIGH)
- {
- lcd.setBacklight(HIGH);
- lcd.setCursor(0,0);
- lcd.backlight();
- lcd.print("");
- lcd.scrollDisplayRight();
- delay(100);
- lcd.setCursor(6,1);
- lcd.print("");
- lcd.setBacklight(LOW);
- }
- else
- {
- Serial.println("OFF");
- }
- delay(500);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement