change log geiger to bcm 0

master
ademant 2019-06-27 05:47:58 +02:00
parent a8c9251f63
commit b6f6d8e2d4
1 changed files with 4 additions and 4 deletions

View File

@ -2,8 +2,8 @@ import time
from datetime import datetime
import RPi.GPIO as GPIO
GPIO.setmode(GPIO.BOARD) # use RaspPi board layout pin numbering
GPIO.setup(27, GPIO.IN, pull_up_down=GPIO.PUD_UP)
GPIO.setmode(GPIO.BCM) # use RaspPi board layout pin numbering
GPIO.setup(0, GPIO.IN, pull_up_down=GPIO.PUD_UP)
counter = 0
@ -13,14 +13,14 @@ def tube_impulse_callback(channel): # threaded callback -- falling edge detected
# when a falling edge is detected on port 12, regardless of whatever
# else is happening in the program, the tube_impulse_callback will be run
GPIO.add_event_detect(12, GPIO.FALLING, callback=tube_impulse_callback)
GPIO.add_event_detect(0, GPIO.FALLING, callback=tube_impulse_callback)
try:
while True:
currentMinute = datetime.now().minute
while datetime.now().minute == currentMinute: # this minute..
time.sleep(1) # .. wait while add_event_detect detects pulses
print counter
print str(counter)+" cpm"
counter=0 # reset counter
except KeyboardInterrupt:
GPIO.cleanup() # clean up GPIO on CTRL+C exit