Today I bought an LCD and connected it to my Rasberry pi in order to make a clock and then an alarm. I have programmed the clock and when I run it there are no issues. The problem is that nothing is shown on the LCD. Here is the guide I am following and I am in step 9:

https://howchoo.com/g/zwq2zwixotu/how-to-make-a-raspberry-pi-smart-alarm-clock. This is the written code:

import I2C_LCD_driver
import time

mylcd = I2C_LCD_driver.lcd()

while True:
    mylcd.lcd_display_string(time.strftime('%I:%M:%S %p'), 1)
    mylcd.lcd_display_string(time.strftime('%a %b %d, 20%y'), 2)

The LCD is on port 27.

Additionally when I type sudo python (filename).py on the terminal, it says that the file does not exist

EDIT:This has been solved and the file runs, yet nothing can be seen on the LCD.I also changed the connections from the LCD to the pi and still nothing works

Any help would be appreciated. THE LINKS ARE PICS

https://ibb.co/d2XCH86 https://ibb.co/nfT863y https://ibb.co/j5G91Tc https://ibb.co/10FHrGQ https://ibb.co/vXxyY7f https://ibb.co/NVmmDmk https://ibb.co/Cvss7Nd

  • 1
    You do NOT need sudo for an I²C device. Is your LCD at 0x27 or 0x3F. Check it with i2cdetect -y 1. – Dougie Mar 13 at 19:54
  • 1
    i did, it is on 0X27, also even without using sudo the problem will stay as : python: can't open file 'testv2.py': [Errno 2] No such file or director – Michalis Vasiliou Mar 13 at 20:15
  • 1
    What does ls testv2.py tell you? In general, "no such file" means exactly that. – Bob Brown Mar 13 at 20:23
  • 2
    The file needs to be in your current directory, not in some other location. I suspect your current directory is not the desktop. Typepwd to find out. – Mark Smith Mar 13 at 20:57
  • 3
    @MichalisVasiliou, why are you asking a question about the LCD when clearly your problem is with running a python script – jsotola Mar 14 at 0:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.