3

I am writing a program in python to blink two led simutaneously. For this I am using beaglebone black pwm pins. Earlier I wrote to blink 5 led's one by one which worked fine. Now I am trying to blink two led together, but that's not working. It is not able to maintain proper sequence, and led 1 and led 3 remains at high, sometimes both and sometimes any one of them. I am new to python any any help is appriciated. My piece of code is below: ``

     import Adafruit_BBIO.PWM as PWM
     import time
     first = "P8_13"
     second = "P8_19"
     third = "P9_14"
     fourth = "P9_16"
     fifth = "P9_42"
     for i in the range (0, 4):
        PWM.start(first, 50, 1000)
        PWM.start(second, 50, 1000)
        PWM.stop("P8_13")
        PWM.stop("P8_19")
        time.sleep(1)
        PWM.start(second, 50, 1000)
        PWM.start(third, 50, 1000)
        PWM.stop("P8_19")
        PWM.stop("P9_14")
        time.sleep(1)
        PWM.start(third, 50, 1000)
        PWM.start(fourth, 50, 1000)
        PWM.stop("P9_14")
        PWM.stop("P9_16")
        time.sleep(1)
        PWM.start(fourth, 50, 1000)
        PWM.start(fifth, 50, 1000)
        PWM.stop("P9_16")
        PWM.stop("P9_42")
        time.sleep(1)
Archana Roy
  • 31
  • 1
  • 7

0 Answers0