python - Beginner can't clear some lines into this code for LCD Screen -
here part of code screen words on lcd screen raspberry pi.
it's work fine can't clear screen between each groups of words. moment : new word written while last words remains on screen
code :
def typewriter_like(sentence, lcd_line, delay=0.7): i,letter in enumerate(sentence): lcd_byte(lcd_line, lcd_cmd) lcd_string(sentence[:i+1],1) time.sleep(delay) mots = (("example", "examples", "exampless", "examplesss"), ("one", "two", "three", "four"), ("lulu", "fifi", "lolo", "riri"), ("new", "neww", "newww", "newwww")) lcds = (0x80, 0xc0, 0x94, 0xd4) list(zip(mots,lcds)) [(('example', 'examples', 'exampless', 'examplesss'),128),(('one', 'two', 'three', 'four'),192),(('lulu', 'fifi', 'lolo', 'riri'),148),(("new", "neww", "newww", "newwww")),128] while true: mot in mots: word, lcd in zip(mot, lcds): typewriter_like(word, lcd) time.sleep(10) word, lcd in zip(mot, lcds): typewriter_like(" " * 20, lcd) time.sleep(4)
basically want clear screen each time 4 words have been printed , have stayed screened 10 seconds.
what want : example/examples/exampless/examplesss : ok... 10 seconds... : all cleared before next 4 words : one,two,three,four
every lcd display has it's own instructions/commands . based on previous questions guess hd44780, if follow linked manual, find list of instructions on page 24 .
my guess following line clear lcd .
lcd_byte(0x01, lcd_cmd)
Comments
Post a Comment