I have a LCD successfully connected to a Raspberry and controled with Python code
I'd like to write slowly a word (like typewriting), a letter after a letter
I've tried different possibility but with no success. And I'm stucked. I need help
here is the code to control the writing on the lcd :
# Send some centred test
lcd_byte(LCD_LINE_1, LCD_CMD)
lcd_string("SENTENCE ONE",2)
lcd_byte(LCD_LINE_2, LCD_CMD)
lcd_string("SENTENCE TWO",2)
lcd_byte(LCD_LINE_3, LCD_CMD)
lcd_string("SENTENCE THREE",2)
lcd_byte(LCD_LINE_4, LCD_CMD)
lcd_string("SENTENCE FOUR",2)
Not tested , but i guess it should help you get started
import time
def typewriter_like(sentence, lcd_line, delay=1):
for i,letter in enumerate(sentence):
lcd_byte(lcd_line, LCD_CMD)
lcd_string(sentence[:i+1], 2)
time.sleep(delay)
# Use it
typewriter_like("Sentence One", LCD_LINE_1)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.