while True:
if (GPIO.input(17) and my_state=='AP'):
my_state = 'normal'
= 'normal' os.system("rm /etc/network/interfaces") os.system("ln -s /etc/network/interfaces.normal /etc/network/interfaces") os.system("ifdown wlan0 && ifup wlan0") os.system("systemctl stop hostapd") os.system("systemctl stop udhcpd") os.system("systemctl disbale hostapd") os.system("systemctl disbale udhcpd")
os.system("rm /etc/network/interfaces")
os.system("ln -s /etc/network/interfaces.normal /etc/network/interfaces")
os.system("ifdown wlan0 && ifup wlan0")
os.system("systemctl stop hostapd")
os.system("systemctl stop udhcpd")
os.system("systemctl disbale hostapd")
os.system("systemctl disbale udhcpd")
if (GPIO.input(21) and my_state==normal):
my_state = 'ap'
os.system("rm /etc/network/interfaces")
os.system("ln -s /etc/network/interfaces.ap /etc/network/interfaces")
os.system("ifdown wlan0 && ifup wlan0")
os.system("systemctl enbale hostapd")
os.system("systemctl enbale udhcpd")
os.system("systemctl start hostapd")
os.system("systemctl start udhcpd")