Advertisement
Muzaffar79

9

Aug 16th, 2018
243
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.31 KB | None | 0 0
  1. #include <Wire.h>
  2. #include <LCD.h>
  3. #include <LiquidCrystal_I2C.h>
  4.  
  5. LiquidCrystal_I2C lcd(0x3F,2,1,0,4,5,6,7,3, POSITIVE);
  6.  
  7. const int PIN_SDA = A4;
  8. const int PIN_SCL = A5;
  9.  
  10. int switch1 = 6;
  11. int switch2 = 5;
  12.  
  13. int counter = 0;
  14. int counter1 = 0;
  15.  
  16. int button1 = 0;
  17. int lastButton1 = 0;
  18.  
  19. int button2 = 0;
  20. int lastButton2 = 0;
  21.  
  22.  
  23. void setup()
  24. {
  25.   lcd.begin (16,2);}
  26.  
  27. void loop()
  28. {
  29.   button1 = digitalRead(switch1);
  30.  
  31.   button2 = digitalRead(switch2);
  32.  
  33.  
  34.   if (button1 != lastButton1)
  35.   {
  36.     if (button1 == HIGH)
  37.     {
  38.  int i;
  39.   lcd.setBacklight(HIGH);
  40.   lcd.setCursor(0,0);
  41.   lcd.backlight();
  42.   lcd.print("MUZAFFAR FARHAN");
  43.   lcd.scrollDisplayRight();
  44.   delay(100);
  45.   lcd.setCursor(0,1);
  46.   lcd.print("YOUTUBE CHANNEL");
  47.   for (i = 0 ; i < 16; i ++) {
  48.     lcd.scrollDisplayLeft();
  49.     delay(200);
  50.   lcd.setBacklight(HIGH);
  51.   }
  52.     }
  53.     else
  54.     {
  55.         Serial.println("OFF");
  56.     }
  57.    delay(10);
  58.   }
  59.  
  60.  
  61.  
  62.   if (button2 != lastButton2)
  63.   {
  64.     if (button2 == HIGH)
  65.     {
  66.    
  67.   lcd.setBacklight(HIGH);
  68.   lcd.setCursor(0,0);
  69.   lcd.backlight();
  70.   lcd.print("");
  71.   lcd.scrollDisplayRight();
  72.   delay(100);
  73.   lcd.setCursor(6,1);
  74.   lcd.print("");
  75.  
  76.   lcd.setBacklight(LOW);
  77.     }
  78.     else
  79.     {
  80.         Serial.println("OFF");
  81.     }
  82.    delay(500);
  83.   }
  84.   }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement