Advertisement
Guest User

Untitled

a guest
Jan 22nd, 2019
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.79 KB | None | 0 0
  1. #include <Wire.h>
  2. #include <LiquidCrystal_I2C.h>
  3.  
  4. const int PinButton = 6;
  5. boolean on = false;
  6. int buttonState = 0;
  7. int position1;
  8.  
  9. LiquidCrystal_I2C lcd(0x3F, 16, 2);
  10.  
  11. void setup() {
  12. pinMode(PinButton, INPUT);
  13. lcd.begin();
  14. lcd.noBacklight();
  15. Serial.begin(9600);
  16.  
  17. }
  18.  
  19. void loop() {
  20. buttonState = digitalRead(PinButton);
  21. if (buttonState == HIGH) {
  22. if (on==true) {
  23. on=false;
  24. } else{
  25. on=true;
  26. }
  27.  
  28. }
  29.  
  30. if (on == true) {
  31. lcd.setBacklight((uint8_t)1);
  32. lcd.setCursor(0,0);
  33. lcd.print("Greenhill School");
  34.  
  35. // for (position1 = 0; position1 < 16; position1++)
  36. // {
  37. // lcd.scrollDisplayLeft();
  38. // delay(250);
  39. // }
  40. }
  41. else {
  42. lcd.noBacklight();
  43. }
  44.  
  45. // lcd.clear();
  46. delay(500);
  47. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement