Advertisement
iyera20

LCD Controlled by Button

Jun 29th, 2017
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. //Atiriya Iyer
  2. //LCD and Button
  3.  
  4. #include <LiquidCrystal.h>
  5. LiquidCrystal lcd (4,5,15, 16, 17, 18);
  6.  
  7. const int pinButton= 2;
  8. boolean buttPress=0;
  9. const int pinPot= A5;
  10.  
  11. void setup()
  12. {
  13. // put your setup code here, to run once:
  14. lcd.begin (16,2);
  15. Serial.begin(9600);
  16. pinMode (pinButton, INPUT);
  17. pinMode (pinPot, INPUT);
  18. lcd.clear();
  19. }
  20.  
  21. void loop()
  22. {
  23. buttPress= digitalRead(pinButton);
  24. Serial.print (buttPress);
  25. buttPress= digitalRead(pinButton);
  26. lcd.clear();
  27. if (buttPress== 1)
  28. lcd.print ("hello");
  29. delay(1000);
  30. lcd.clear();
  31. buttPress= digitalRead(pinButton);
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement