menu_book Course Curriculum (Raspberry Pi) expand_more
Linux & Setup
GPIO Digital I/O
Sensors & Buses
Automation
Networking & Services
edge detection
Learn edge detection in Raspberry Pi with a dedicated explanation, a concept-specific example, practical cautions, and a mastery check.
12 min read
•
Beginner
raspberry-pi-016.py
python
import RPi.GPIO as GPIO
GPIO.setmode(GPIO.BCM); GPIO.setup(2,GPIO.IN,pull_up_down=GPIO.PUD_UP)
GPIO.add_event_detect(2,GPIO.FALLING,callback=lambda ch: print('pressed'),bouncetime=100)
input('Enter to stop'); GPIO.cleanup()
What to watch
Content source & attribution
Original Syntaxis Content · Original Syntaxis Content