Hello Again Sir, Mr. Dennis...Seth here again. I also tried PWM as an output to the L298 Board. I listed some software below in case you wanted to view it. Oh and I tried w/ the while loop hashed out (#) and w/ it as it is now. Well, here it is:
#!/usr/bin/python import Adafruit_BBIO.PWM as PWM #import time MotorOne = "P9_21" MotorTwo = "P9_22" PWM.start(MotorOne, 50, 20, 0) PWM.start(MotorOne, 50, 20, 0) while True: taco = (MotorOne, 1) bien = (MotorTwo, 1) print "I love Lucy!" #for i in range(1, 30): #taco = (MotorOne, 30) #bien = (MotorTwo, 30) #print "I think Lucy is a cheat!" #for i in range(1, 54): #taco = (MotorOne, 30, -1) #bien = (MotorTwo, 30, -1) #print "She probably is a cheat!" PWM.stop(MotorOne) PWM.stop(MotorTwo) PWM.cleanup So, you see. I cannot make PWM work or GPIO work on this board. I know it is me. It cannot be a faulty board. I push the power button after applying power, 12v 1.3Ah, and the LED stays lit. Seth P.S. I understood what you typed in your last e-mail post in this forum on this subject. I was not expecting any certain outcome. I was testing software w/ this motor driver to see if things would just make the motors turn. It is that simple. Now, if the motors did turn and the recorded effect was pleasing, I would not have to change anything. But, if the motors turned incorrectly for me, I would then investigate further what I could do w/ the software to change this fact. On Thursday, May 3, 2018 at 10:15:12 AM UTC-5, Dennis Lee Bieber wrote: > > On Wed, 2 May 2018 21:51:08 -0700 (PDT), Mala Dies > <fun...@gmail.com <javascript:>> declaimed the following: > > >import Adafruit_BBIO.GPIO as GPIO > >import time > > > >GPIO.setup("P9_21", GPIO.OUT) > >GPIO.setup("P9_22", GPIO.OUT) > >GPIO.setup("P9_12", GPIO.OUT) > >GPIO.setup("P9_15", GPIO.OUT) > > > >m1a = GPIO.output("P9_21", GPIO.HIGH) > >m1a = GPIO.output("P9_22", GPIO.HIGH) > > Meaningless assignments... First, the return from the second line > replaces the value returned by the first line, since you used the same > name > for the return. > > On the other hand -- based upon the documentation for the library, > GPIO.output() doesn't return anything so you are just replacing None with > None. > > >m1b = GPIO.output("P9_12", GPIO.HIGH) > >m1b = GPIO.output("P9_15", GPIO.HIGH) > > > Ditto > > You've set all control pins high -- which should, for any motor > controller I can envision, mean the motors are not powered (BTW -- you did > wire the ENABLE A and B pins to something, didn't you? > > >while (True): > > > > try: > > for motor in range (0, 101, 1): #starts at 0, steps up to > >101 in 1 steps > > m1a = ("P9_21") > > Here you assign a string to the name, but you never do anything > with > the string. So... again a meaningless assignment. > > > time.sleep(3) > > print(motor) > > And you never do anything with the motor pin itself, so nothing > changes. > > This loop condenses down to just printing integers from 0..100 > with a 3 > second pause between them, and it does all of them before moving to the > next loop, which does the very same thing. > > > for motor in range (0, 101, 1): > > m1a = ("P9_22") > > time.sleep(3) > > print(motor) > > for motor in range (100, -1, -1): > > m1b = ("P9_12") > > time.sleep(3) > > print(motor) > > for motor in range (100, -1, -1): > > m1b = ("P9_15") > > time.sleep(3) > > print(motor) > > > > What behavior are you expecting since the above four loops are > coded to > run on after the other -- nothing is being done in parallel even if you > were changing motor pin settings. > > > except(KeyboardInterrupt): > > > > #And final cleanup > > print "You have just ended your camp trip!" > > GPIO.cleanup() > > quit() > > Your "final cleanup" will only be performed IF you hit <ctrl-c> > BEFORE > the loops run out. Otherwise, you just fall off the end of the program > with > no cleanup performed > > > My suggestion -- since you are using Python... > > Open a shell and run Python in interactive mode, and then enter > GPIO > statements one at a time setting pins to HIGH and LOW, in various > combinations, to see what it takes to activate the motors. > > > And, just for a giggle (untested as I don't have your hardware > present) > > -=-=-=-=- > """ > Pseudo-code for fictitious robot-car with two driving wheels, using > brushed DC motors; I do not have the driver board or motors so this > is just text of what I believe would be needed > > NOTE: THIS IS PYTHON 2.7 SYNTAX; modify as needed for 3.x > """ > > import time > import Adafruit_BBIO.GPIO as GPIO > > class BrushedDC(object): > def __init__(self, p1, p2): > self.p1 = p1 > self.p2 = p2 > GPIO.setup(self.p1, GPIO.OUT) > GPIO.setup(self.p2, GPIO.OUT) > self.stop() > def stop(self): > GPIO.output(self.p1, GPIO.LOW) > GPIO.output(self.p2, GPIO.LOW) > def forward(self): > self.stop() #safety to avoid shock of reversals > GPIO.output(self.p1, GPIO.HIGH) > GPIO.output(self.p2, GPIO.LOW) > def reverse(self): > self.stop() > GPIO.output(self.p1, GPIO.LOW) > GPIO.output(self.p2, GPIO.HIGH) > > class Car(object): > def __init__(self, leftMotor, rightMotor): > self.leftMotor = leftMotor > self.rightMotor = rightMotor > self.stop() > def stop(self, wait=0): > self.leftMotor.stop() > self.rightMotor.stop() > time.sleep(wait) > def forward(self, wait=0): > self.leftMotor.forward() > self.rightMotor.forward() > time.sleep(wait) > def reverse(self, wait=0): > self.leftMotor.reverse() > self.rightMotor.reverse() > time.sleep(wait) > def leftTurnForward(self, wait=0): > self.leftMotor.stop() > self.rightMotor.forward() > time.sleep(wait) > def rightTurnForward(self, wait=0): > self.leftMotor.forward() > self.rightMotor.stop() > time.sleep(wait) > def leftTurnReverse(self, wait=0): > self.leftMotor.stop() > self.rightMotor.reverse() > time.sleep(wait) > def rightTurnReverse(self, wait=0): > self.leftMotor.reverse() > self.rightMotor.stop() > time.sleep(wait) > def leftPivot(self, wait=0): > self.leftMotor.reverse() > self.rightMotor.forward() > time.sleep(wait) > def rightPivot(self, wait=0): > self.leftMotor.forward() > self.rightMotor.reverse() > time.sleep(wait) > > > myCar = Car(leftMotor=BrushedDC(p1="P9_21", p2="P9_22"), > rightMotor=BrushedDC(p1="P9_12", p2="P9_15")) > > myCar.forward(10) > myCar.leftPivot(3) > myCar.forward(5) > myCar.rightTurnReverse(3) > myCar.reverse(10) > myCar.stop(10) > myCar.rightPivot(30) > myCar.forward(5) > myCar.rightTurnForward(15) > myCar.stop() > > GPIO.cleanup() > > -=-=-=-=-=- > > > > -- > Wulfraed Dennis Lee Bieber AF6VN > wlf...@ix.netcom.com <javascript:> > 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 beagleboard+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/beagleboard/a3c0c932-8a14-4c00-8198-3964489d6d21%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.