import RPi.GPIO as GPIO
import time
import subprocess

BUTTON = 17

GPIO.setmode(GPIO.BCM)
GPIO.setup(BUTTON, GPIO.IN)

while True:
    state = GPIO.input(BUTTON)
    if not state:
        #print("BUTTON PRESSED!")
        subprocess.Popen(["sh", "/home/pi/radio/end_radio.sh"])
    time.sleep(0.5)