All worked out now as part of https://www.hackster.io/silver2row/beaglebone-black-and-l298-motor-driver-in-python-2156be ?
Good timing as BeagleBoard.org Motor Cape ( https://github.com/beagleboard/capes/blob/master/beaglebone/designs/Motor/Motor_Cape_sch.pdf, https://beagleboard.org/capes) is about to start shipping to distributors. It'll likely go out in about 2 weeks, depending on when I get https://github.com/jadonk/beagle-tester updated for it. On Sun, May 6, 2018 at 9:46 PM Dennis Lee Bieber <[email protected]> wrote: > On Sun, 6 May 2018 14:20:17 -0700 (PDT), Mala Dies > <[email protected]> declaimed the following: > > > >while True: > > > > for i in range(10): > > EnA = GPIO.output("P9_21", GPIO.HIGH) > > 1) the variable names on the left of useless as they are never > referenced anywhere else in the code. > > 2) this loop just sets the pin to the SAME VALUE 10 times in > a row. > > > for i in range(3): > > ln1 = GPIO.output("P9_22", GPIO.HIGH) > > 3 times, same value > > > for i in range(5): > > ln2 = GPIO.output("P9_12", GPIO.HIGH) > > 5 times... > > > for i in range(4): > > ln1 = GPIO.output("P9_22", GPIO.LOW) > > 4 times... > > > for i in range(10): > > EnA = GPIO.output("P9_21", GPIO.LOW) > > print "Go, Go Bananas!" > > 10 times, with a repeated print statement. > > > The total effect condenses down to (and to make it more clear, I'm > going to set up "constants" for the pins): > > ENA = "P9_21" > IN1 = "P9_22" > IN2 = "P9_12" > # I'm presuming the default startup state is all GPIO's LOW, but one > #should check the documentation for the BBB to confirm > while True: > GPIO.output(ENA, GPIO.HIGH) #enable motor control, motor in > STOP > time.sleep(0.1) #or however long 10 calls to GPIO_output consume > GPIO.output(IN1, GPIO.HIGH) #motor running FORWARD > time.sleep(0.03) #or however long 3 calls takes to execute > GPIO.output(IN2, GPIO.HIGH) #motor in STOP > time.sleep(0.05) #or whatever 5 calls takes > GPIO.outputIN1, GPIO.LOW) #motor running REVERSE > time.sleep(0.04) #or whatever 4 calls takes > GPIO.output(ENA, GPIO.LOW) #motor coasting to stop > time.sleep(0.2) #assumes 10 calls and 10 prints > > Note that, since the state was REVERSE when you disabled control, > the > next pass of the loop will START in REVERSE when you enable control. THEN > when you set IN1 to HIGH, the motor will go to hard stop (since IN2 is > still HIGH from the first time through the loop). It will stay in STOP > until you set IN1 to LOW, when it again will run in REVERSE until the ENA > is turned off. > > > -- > Wulfraed Dennis Lee Bieber AF6VN > [email protected] HTTP://wlfraed.home.netcom.com/ > > -- > 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]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/beagleboard/9v8vedt460upknng78b9j6ec2vpaq9l20k%404ax.com > . > For more options, visit https://groups.google.com/d/optout. > -- https://beagleboard.org/about -- 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]. To view this discussion on the web visit https://groups.google.com/d/msgid/beagleboard/CA%2BT6QPnd-gXToxRsD5%3Dv5Aac7XMQ5%2BBtvnNFBNmVGDhufHCEdQ%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
