Guest User

Untitled

a guest
Oct 17th, 2017
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.97 KB | None | 0 0
  1. import time
  2. import Adafruit_CharLCD as LCD
  3.  
  4. # Raspberry Pi pin configuration:
  5. lcd_rs = 12
  6. lcd_en = 7
  7. lcd_d4 = 8
  8. lcd_d5 = 25
  9. lcd_d6 = 24
  10. lcd_d7 = 23
  11. lcd_backlight = 5
  12.  
  13. # Define LCD column and row size for 16x2 LCD.
  14. lcd_columns = 16
  15. lcd_rows = 2
  16.  
  17. # Initialize the LCD using the pins above.
  18. lcd = LCD.Adafruit_CharLCD(lcd_rs, lcd_en, lcd_d4, lcd_d5, lcd_d6, lcd_d7,
  19. lcd_columns, lcd_rows, lcd_backlight)
  20.  
  21. lcd.set_cursor(0,0)
  22. lcd.message("hello, world! ")
  23. for i in range(0,501):
  24. lcd.set_cursor(0,1)
  25. lcd.message(str(i))
  26. time.sleep(1)
  27.  
  28. lcd.clear()
  29. lcd.set_cursor(16,1)
  30. lcd.autoscroll(1)
  31. for i in range(0,10):
  32. lcd.message(str(i))
  33. time.sleep(0.5)
  34. lcd.autoscroll(0)
  35.  
  36. lcd.clear()
  37. lcd.message(" Scrolling Text \nshahrulnizam.com")
  38. for i in range(0,15):
  39. time.sleep(0.5)
  40. lcd.move_right()
  41. for i in range(0,15):
  42. time.sleep(0.5)
  43. lcd.move_left()
  44. time.sleep(1)
  45.  
  46. lcd.clear()
  47. lcd.message("Goodbye!")
Add Comment
Please, Sign In to add comment