Advertisement
Guest User

Untitled

a guest
Nov 26th, 2014
264
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.80 KB | None | 0 0
  1. const int buttonPin = 6;
  2. const int buttonPin2 = 7;
  3. int buttonState = 0;
  4. int buttonState2 = 0;
  5.  
  6. #include <LiquidCrystal.h>
  7. LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
  8.  
  9.  
  10. void setup() {
  11.   pinMode(buttonPin, INPUT);
  12.   lcd.begin(16, 2);
  13.   lcd.print("test1");
  14.   lcd.setCursor(0, 1);
  15.   lcd.print("test2");
  16.   pinMode(buttonPin, INPUT_PULLUP);
  17.   pinMode(buttonPin2, INPUT_PULLUP);
  18.  
  19. }
  20.  
  21. void loop() {
  22.   buttonState = digitalRead(buttonPin);
  23.   buttonState2 = digitalRead(buttonPin2);
  24.   if (buttonState == HIGH) {    
  25.     lcd.begin(16, 2);
  26.   lcd.print(">test1");
  27.   lcd.setCursor(0, 1);
  28.   lcd.print("test2");
  29.   }
  30.   else {
  31.   }
  32.   if (buttonState2 == HIGH) {      
  33.     lcd.begin(16, 2);
  34.   lcd.print("test1");
  35.   lcd.setCursor(0, 1);
  36.   lcd.print(">test2");
  37.   }
  38.   else {
  39.  
  40.   }
  41.   delay(3);
  42.  
  43. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement