Dec-19-2018, 03:46 PM
Hello, i'm new in the forum and i' begin in Python. I want to detect rising edge of incremental encoder and mesure the time between tow rising edge.
I do a code, but this code display the actual time. But i need the second time when i have another rising edge. I don't know how to do
I do a code, but this code display the actual time. But i need the second time when i have another rising edge. I don't know how to do
# coding: utf-_ import RPi.GPIO as GPIO import time temps = time.time() def callback_up(channel) : temps = time.time() print temps) GPIO.setmode(GPIO.BCM) PIR = 23 GPIO.setup(PIR, GPIO.IN) try: GPIO.add_event_detect(PIR, GPIO.RISING, callback=callback_up) while 1: time.sleep(10) exept KeyboardInterrupt: print("fin")thank you