Advertisement
vedavelamuri

LCD and a Tilt

Oct 17th, 2017
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. #include <LiquidCrystal.h>
  2. //initialize library with numbers of interface pins
  3. LiquidCrystal lcd(12, 11, 5, 4, 3, 2); //pins for RS, E, D4, D5, DG, D7 respectively
  4. const int tiltpin=7;
  5. int newTilt;
  6. void setup()
  7. {
  8. //set up the number of columns and rows on the LCD
  9. lcd.begin(16,2);
  10. lcd.setCursor(5,0);
  11. lcd.print ("veda");
  12. //set the cursor to column 0, line 1
  13. //line 1 is the second row, since counting begins with 0
  14. lcd.setCursor (1,1);
  15. //print to the second line
  16. lcd.print ("I am awesome");
  17. Serial.begin (9600);
  18. }
  19.  
  20. void loop()
  21. {
  22. newTilt = digitalRead (tiltpin);
  23. Serial.println (newTilt);
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement