first line of the python code works but other lines do not work



  • hello the first line of the python code works but other lines do not work what is my mistakes I make in this code

    import time
    import subprocess
    import schedule
    
    
    def besle():
        time.sleep(1)
        subprocess.check_output(["fast-gpio", "pwm", "19", "200", "10"])
        time.sleep(1)
        print "1"
        time.sleep(3)
        subprocess.check_output(["fast-gpio", "pwm", "18", "200", "24"])
        time.sleep(1)
        print "2"
        time.sleep(3)
        subprocess.check_output(["fast-gpio", "pwm", "19", "200", "10"])
        time.sleep(3)
        subprocess.check_output(["fast-gpio", "pwm", "19", "200", "12"])
        time.sleep(3)
        subprocess.check_output(["fast-gpio", "pwm", "19", "200", "14"])
        time.sleep(3)
        subprocess.check_output(["fast-gpio", "pwm", "19", "200", "16"])
        time.sleep(3)
        subprocess.check_output(["fast-gpio", "pwm", "19", "200", "18"])
        time.sleep(3)
        subprocess.check_output(["fast-gpio", "pwm", "19", "200", "20"])
        time.sleep(3)
        subprocess.check_output(["fast-gpio", "pwm", "18", "200", "10"])
        time.sleep(5)
        subprocess.check_output(["fast-gpio", "pwm", "19", "200", "37"])
        time.sleep(5)
        subprocess.check_output(["fast-gpio", "pwm", "18", "200", "24"])
        time.sleep(7.5)
        subprocess.check_output(["fast-gpio", "pwm", "19", "200", "47"])
        time.sleep(9)
        subprocess.check_output(["fast-gpio", "pwm", "19", "200", "60"])
        time.sleep(7.5)
        subprocess.check_output(["fast-gpio", "pwm", "18", "200", "10"])
        time.sleep(5)
        subprocess.check_output(["fast-gpio", "set", "19", "0"])
        time.sleep(1)
        subprocess.check_output(["fast-gpio", "set", "18", "0"])
        time.sleep(1)
        print "Besleme yapildi! " + time.asctime(time.localtime(time.time()))
        time.sleep(1)
    
    
    schedule.every().day.at("07:00").do(besle)
    schedule.every().day.at("12:00").do(besle)
    schedule.every().day.at("17:00").do(besle)
    schedule.every().day.at("01:22").do(besle)
    
    while True:
        schedule.run_pending()
        time.sleep(1)
    
    


  • solved i used call method to solve this problem

    example:
    subprocess.call(["fast-gpio", "pwm", "19", "200", "10"])


Log in to reply
 

Looks like your connection to Community was lost, please wait while we try to reconnect.