Take time.time modulo 1 and not sleep.time, and paste it into one program
eg:
>>> "LED off" if time.time()%1 > .5 else  "LED on"



On Mon, Nov 25, 2013 at 7:53 PM,  <[email protected]> wrote:
> Goodevening,
>
> Does anybody have an idea how to run these 2 scripts at the same time?
>
> What would be the best way to?
>
> I have tried to activate the 2 scripts with a bashscript, but this gave some
> weird results.
>
> The goal is that the BBB completes the grafcet and has a blinking green LED
> to show it's running.
>
> I know I could just paste running_green under grafcet, but then the timing
> of the blinking would not be correct.
>
> Here are the 2 python scripts:
> Grafcet.py
>
> #!/usr/bin/python
>
> import Adafruit_BBIO.GPIO as GPIO
> import time
>
> GPIO.setup("P8_12", GPIO.OUT)
> GPIO.setup("P8_14", GPIO.OUT)
> GPIO.setup("P8_16", GPIO.OUT)
> GPIO.setup("P8_18", GPIO.OUT)
> GPIO.setup("P8_11", GPIO.IN)
> GPIO.setup("P8_13", GPIO.IN)
> GPIO.setup("P8_15", GPIO.IN)
> GPIO.setup("P8_17", GPIO.IN)
> GPIO.setup("P8_19", GPIO.IN)
>
> X = 0
>
> while True:
>         # stap 1
>   if GPIO.input("P8_11") and X == 0:
>                 GPIO.output("P8_12", GPIO.HIGH)
>                 X +=  1
>                 print"Step 1: Boiling ingredients"
>         # stap 2
>         elif GPIO.input("P8_13") and X == 1:
>                 GPIO.output("P8_14", GPIO.HIGH)
>                 GPIO.output("P8_12", GPIO.LOW)
>                 X += 1
>                 print"Step 2: Add yeast and sugar"
> elif GPIO.input("P8_15") and X == 2:
>                 GPIO.output("P8_16", GPIO.HIGH)
>                 GPIO.output("P8_14", GPIO.LOW)
>                 X += 1
>                 print"Step 3: fermenting for 6 weeks"
>         # stap 4
>         elif GPIO.input("P8_17") and X == 3:
>                 GPIO.output("P8_16", GPIO.LOW)
>                 X = 0
>                 print"End of cycle, beer is ready"
>         # noodstop NC
>         elif GPIO.input("P8_19") == False:
>                 X = 5
>                 print"Emergency button has been activated!"
>         time.sleep(.1)
>
> running_green.py
>
> #!/usr/bin/python
>
> import Adafruit_BBIO.GPIO as GPIO
> import time
>
> GPIO.setup("P8_18", GPIO.OUT)
>
> while True:
>         time.sleep(.5)
>         GPIO.output("P8_18", GPIO.HIGH)
>         time.sleep(.5)
>         GPIO.output("P8_18", GPIO.LOW)
>
> --
> For more options, visit http://beagleboard.org/discuss
> ---
> You received this message because you are subscribed to the Google Groups
> "BeagleBoard" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/groups/opt_out.

-- 
For more options, visit http://beagleboard.org/discuss
--- 
You received this message because you are subscribed to the Google Groups 
"BeagleBoard" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to