Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //something like this
- import RPi.GPIO as GPIO
- import time
- channel = 17
- GPIO.setmode(GPIO.BCM)
- GPIO.setup(channel, GPIO.IN)
- count = 0
- def callback(channel):
- if GPIO.input(channel):
- print " PWM high value"
- count += 1
- else:
- print " PWM Low value"
- GPIO.add_event_detect(channel, GPIO.BOTH, bouncetime=300)
- #assign callback function to GPIO pin
- GPIO.add_event_callback(channel, callback)
- while True:
- time.sleep(1)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement