Python Forum
Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
rising edge of detection
#8
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
Reply


Messages In This Thread
rising edge of detection - by peter14 - Dec-19-2018, 03:46 PM
RE: rising edge of detection - by Larz60+ - Dec-19-2018, 03:56 PM
RE: rising edge of detection - by peter14 - Dec-19-2018, 08:08 PM
RE: rising edge of detection - by Larz60+ - Dec-20-2018, 01:05 AM
RE: rising edge of detection - by peter14 - Dec-20-2018, 09:20 AM
RE: rising edge of detection - by Larz60+ - Dec-20-2018, 03:52 PM
RE: rising edge of detection - by peter14 - Dec-23-2018, 07:09 PM
RE: rising edge of detection - by peter14 - Dec-27-2018, 10:27 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Python Networkx: Visualize an edge weight with a bubble/circle uvw 0 2,007 Sep-01-2021, 06:26 AM
Last Post: uvw
Photo Setting Marker Edge Color In Plotting JoeDainton123 0 2,721 Oct-26-2020, 10:48 PM
Last Post: JoeDainton123
  How do I apply a Gaussian blur to a particular edge of geometry in Matplotlib? hbolandi 0 2,010 Feb-02-2020, 06:08 PM
Last Post: hbolandi
  Randomise network while maintaining topology of nodes using edge-swap approach Tom1988 3 4,124 May-25-2017, 10:59 PM
Last Post: ichabod801

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020