This is my code:
Code: Select all
import RPi.GPIO as GPIO
import time
from subprocess import call
GPIO.setmode(GPIO.BCM)
GPIO.setup(16,GPIO.IN,pull_up_down=GPIO.PUD_UP)
flag = False
while True:
input = GPIO.input(16)
if(input == False):
if(flag == False):
print "calling deluged"
call(["deluged"])
flag = True
time.sleep(0.2)
else:
print "killing deluged"
call(["pkill","deluged"])
flag = False
time.sleep(0.2)
What am i doing wrong?
Thank you

Edit: i'm trying to start deluged with a script
Code: Select all
#!/bin/bash
deluged
but it doesn't work