Title: Displaying Messages on Two LCD Lines Create a Python that utilizes two li
ID: 3667569 • Letter: T
Question
Title: Displaying Messages on Two LCD Lines
Create a Python that utilizes two lines on the Adafruit LCD display.
The newline character is used to force the next character to a new line. The 16x2 LCD could display a total of 32 characters at a time: 16 characters on Line 1 and 16 characters on Line 2. Spaces are used to center text on a line. Refer to the program below.
Boot up the Raspberry Pi.
Open IDLE.
Enter the program below.
Name = 'Put Your Name Here'
Class = 'ECT109'
Assignment = 'Week 6 Lab 1'
#------------------------------------------------------
# Display messages on two lines
#------------------------------------------------------
import time
from time import sleep
from Adafruit_CharLCDPlate import Adafruit_CharLCDPlate
lcd = Adafruit_CharLCDPlate()
lcd.clear()
lcd.message(“ John Doe ECT109”)
sleep(3)
lcd.clear()
lcd.message(“done”)
Run the program. Observe the results.
Your assignment is to modify the above program to add another two-line message (such as “Week 6 & Lab 1”). Make sure to pause between messages.
Explanation / Answer
import time
from time import sleep
from Adafruit_CharLCDPlate import Adafruit_CharLCDPlate
lcd = Adafruit_CharLCDPlate()
lcd.clear() #clear screen
lcd.message("Week 6 ") #display on first line
lcd.message("Lab 1") #display on second line
sleep(3) # pausing for 3 seconds
lcd.clear()
lcd.message("John Doe ECT109")
sleep(3)
lcd.clear()
lcd.message("done")
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.