Display the Time

The program Display.py displays the current time and ip adress of your Raspberry Pi on the LCD. To run the program open a new terminal window and use the command cd CS2N-Raspberry-Pi-Projects\LCD to switch to the directory containing the code. In this directory run the command python Display.py to start the display

It is likely that you will not immediately see the text on the LCD. To display the text, slowly turn the potentiometer back and forth until the text is visible.

Changing the Message

In the Display.py file, this block of code sets the text on the display. The while statement at the top of the code causes the display to show the specified text until the push button is pressed. The next line clears the display so that the time can be updated. The next chunk of code gets the Raspberry Pi's ip address and converts it to a string that can be displayed. The final three lines of the program set the message on the display.

To display a message of your own, you can edit the content between the two parentheses after the lcd.message command. The message you display must be in string format, so you have to put the text in the message in quotes. To display a number or variable that is not a string, put the number or string inside parentheses with str in the front. For example, to display "Jeff is 19 years old" you would write lcd.message("Jeff is " + str(19) + " years old").


Your LCD display is complete!