Dec-27-2018, 10:27 AM
Hello, i do an other code who works, i just have a problem whith the lcd. When he displays a big number an after i have an other smaller number, the lcd keep figures that exess. So i want that the first linechange all the number. Can you help me?
# coding: utf-8 import RPi.GPIO as GPIO import lcddriver import time GPIO.setmode(GPIO.BCM) GPIO.setup(23, GPIO.IN) lcd = lcddriver.lcd() start_time = time.time() def effacer_ligne(): lcd.lcd_display_string(" ",1) GPIO.add_event_detect(23, GPIO.RISING) def delta_angle(): counter = 0 base_temps=time.time() delta_temps=0 while delta_temps<1 : if GPIO.event_detected(23): counter +=1 delta_temps=(time.time())-(base_temps) return(counter) while 1: start_time=time.time()#definition base des temps vitesse = delta_angle()/((time.time())-(start_time))#delta angle / delta temps vitesse2 = ((vitesse/128)*258) vitesse3 = "%.0f"% vitesse2 lcd.lcd_display_string(" "+(vitesse3),1) lcd.lcd_display_string(" cm/min",2) #time.sleep(1) #effacer_ligne()thank you