I found this script to show date an time on this site: http://www.circuitbasics.com/raspberry-pi-i2c-lcd-set-up-and-programming/
Once is running how can be it stoped? I like the idea of showing the hour when teh raspi is on, but I need to stop it at some point and I do not know hoy to do that. This raspi is runnig some scripts with cron and don ́t use a keyboard so, ctrl+c is not an option. Maybe an script?
This is the script to show date and time
This is the script to show date and time
import I2C_LCD_driver import time mylcd = I2C_LCD_driver.lcd()
while True: mylcd.lcd_display_string("Time: %s" %time.strftime("%H:%M:%S"), 1) mylcd.lcd_display_string("Date: %s" %time.strftime("%m/%d/%Y"), 2)
Thanks in advance
1 Answer 1
Did it! Thank you all. sudo killall did what I needed. Then, you forced me to read some more and find the solution I need, to stop the loop when a GPIO is on "high state" :
while (GPIO.input(22) == 0):
mylcd.lcd_display_string("Time: %s" %time.strftime("%H:%M:%S"), 1)
if (GPIO.input(22) == 1):
break
Then the script to control GPIO 22 will send another message to the LCD. Thanks guys!
-
Well done for the research. I suggest you also add a
time.sleep(0.1)
to the while loop.joan– joan2017年03月10日 13:54:59 +00:00Commented Mar 10, 2017 at 13:54 -
Please accept your own answer with a click on the tick on its left side. Only this will finish the question and it will not pop up again year for year.Ingo– Ingo2020年01月24日 10:05:38 +00:00Commented Jan 24, 2020 at 10:05
sudo killall python
.