You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
multi_cam/read_sensor.py

18 lines
482 B

#!/usr/bin/python3
import time
import Adafruit_BBIO.GPIO as GPIO
# Set up gpio 60 as input
GPIO.setup("P9_12", GPIO.IN)
# Sets an event when pin 60 changes to 1
GPIO.add_event_detect("P9_12", GPIO.RISING)
i = 0
while True:
time.sleep(1)
if GPIO.event_detected("P9_12"):
f = open('/tmp/sensor', 'w')
f.write(str(int(time.time())) + '\n')
f.close()
i = i + 1
print(str(i) + " Event!!!")