2 from gpiozero import Button
6 # https://gpiozero.readthedocs.io/en/stable/recipes.html#pin-numbering
7 # https://www.raspberrypi.org/documentation/usage/gpio/
9 # Add this line in /etc/rc.local
10 # /usr/local/networktool-web/script/boot_ap_mode.py 2>&1 > /tmp/boot_ap_mode.txt
12 # This script is used to boot with AP mode or WiFi mode.
13 # Run this in rc.local. When boot, it check the GPIO 21, if it is Low level (connected to Ground)
14 # Then it starts with AP mode
16 DIR = os.path.dirname(os.path.realpath(__file__))
20 print 'button is pressed, switch to ap mode\n'
21 subprocess.check_call(DIR + '/startHostapd.sh', shell=True)