Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import time
- import Adafruit_CharLCD as LCD
- # Raspberry Pi pin configuration:
- lcd_rs = 12
- lcd_en = 7
- lcd_d4 = 8
- lcd_d5 = 25
- lcd_d6 = 24
- lcd_d7 = 23
- lcd_backlight = 5
- # Define LCD column and row size for 16x2 LCD.
- lcd_columns = 16
- lcd_rows = 2
- # Initialize the LCD using the pins above.
- lcd = LCD.Adafruit_CharLCD(lcd_rs, lcd_en, lcd_d4, lcd_d5, lcd_d6, lcd_d7,
- lcd_columns, lcd_rows, lcd_backlight)
- lcd.set_cursor(0,0)
- lcd.message("hello, world! ")
- for i in range(0,501):
- lcd.set_cursor(0,1)
- lcd.message(str(i))
- time.sleep(1)
- lcd.clear()
- lcd.set_cursor(16,1)
- lcd.autoscroll(1)
- for i in range(0,10):
- lcd.message(str(i))
- time.sleep(0.5)
- lcd.autoscroll(0)
- lcd.clear()
- lcd.message(" Scrolling Text \nshahrulnizam.com")
- for i in range(0,15):
- time.sleep(0.5)
- lcd.move_right()
- for i in range(0,15):
- time.sleep(0.5)
- lcd.move_left()
- time.sleep(1)
- lcd.clear()
- lcd.message("Goodbye!")
Add Comment
Please, Sign In to add comment