임베디드/RaspberryPi
p265 6-4 폴링방식
sj0020
2020. 10. 22. 14:55
#btn_poll.py
import RPi.GPIO as GPIO #gpio모듈 사용
import time #time 모듈 사용
GPIO.setmode(GPIO.BCM)
GPIO.setup(24,GPIO.IN)
count =0
while True:
value = GPIO.input(24)
if value == True:
count= count +1
print count
time.sleep(0.1)