From f6d460275551bbf5b85680edb677e96fc1234614 Mon Sep 17 00:00:00 2001 From: Ondrej Mikle Date: Sun, 29 Apr 2018 20:04:05 +0200 Subject: [PATCH] Sample startup script that prepares BCM GPIO PIN 22 with pullup to be used with OPEN/CLOSED switch --- brmdoor_start.sh | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 brmdoor_start.sh diff --git a/brmdoor_start.sh b/brmdoor_start.sh new file mode 100644 index 0000000..7d17109 --- /dev/null +++ b/brmdoor_start.sh @@ -0,0 +1,17 @@ +#!/bin/bash + + +#Prepare input PIN as input with pullup for the OPEN/CLOSED switch +#Configure the same PIN number in brmdoor_nfc.config in [open_switch] section +export PIN=22 + +if [ '!' -d /sys/class/gpio/gpio$PIN ]; then + echo $PIN > /sys/class/gpio/export + echo in > /sys/class/gpio/gpio$PIN/direction +fi + +python -c "import wiringpi; wiringpi.wiringPiSetupGpio(); wiringpi.pinMode($PIN, wiringpi.INPUT); wiringpi.pullUpDnControl($PIN, wiringpi.PUD_UP)" + +cd /root/brmdoor_libnfc/ +/usr/bin/python2 brmdoor_nfc_daemon.py brmdoor_nfc.config +