RE: LoadCape and One GPIO for One, Single Motor/BBB and Adafruit_BBIO.GPIO as GPIO

49 views
Skip to first unread message

Mala Dies

unread,
Dec 23, 2018, 2:47:42 PM12/23/18
to BeagleBoard
Hello,

First bits! Software and the LoadCape:


import time
import Adafruit_BBIO.GPIO as GPIO
# from help on the googlegroups section of bbb.io!

m1 = "P9_42"
#m2 = "P9_41"

class LeftMotor(object):

     def __init__(self, m1):
        self.m1 = m1
        GPIO.setup(self.m1, GPIO.OUT)
        self.stop()

     def stop(self):
        GPIO.output(self.m1, GPIO.LOW)

     def forward(self):
        GPIO.output(self.m1, GPIO.HIGH)

     def reverse(self):
        GPIO.output(self.m1, GPIO.HIGH)

#class RightMotor(object):

#    def __init__(self, m2):
#        self.m2 = m2
#        GPIO.setup(self.m2, GPIO.OUT)
#        self.stop()

#    def stop(self):
#        GPIO.output(self.m2, GPIO.LOW)

#    def forward(self):
#        GPIO.output(self.m2, GPIO.LOW)

#    def reverse(self):
#        GPIO.output(self.m2, GPIO.HIGH)

class LeftWheel(object):
   def __init__(self, LeftMotor):
       self.LeftMotor = LeftMotor
       self.stop()

    def stop(self, go=5):
       self.LeftMotor.stop()
       time.sleep(1)

    def forward(self, go=5):
       self.LeftMotor.forward()
       time.sleep(1)

    def reverse(self, go=5):
       self.LeftMotor.reverse()
       time.sleep(1)

    def leftTurnForward(self, go=5):
       self.leftMotor.stop()
       time.sleep(1)

    def rightTurnForward(self, go=5):
       self.LeftMotor.forward()
       time.sleep(1)

    def leftTurnReverse(self, go=5):
       self.LeftMotor.stop()
       time.sleep(1)

    def rightTurnReverse(self, go=5):
       self.LeftMotor.reverse()
       time.sleep(1)

    def leftPivot(self, go=5):
       self.LeftMotor.reverse()
       time.sleep(1)

    def rightPivot(self, go=5):
       self.LeftMotor.forward()
       time.sleep(1)

#class RightWheel(object):

#    def __init__(self, RightMotor):
#        self.RightMotor = RightMotor
#        self.stop()

#    def stop(self, go=5):
#        self.RightMotor.stop()
#        time.sleep(1)

#    def forward(self, go=5):
#        self.RightMotor.forward()
#        time.sleep(1)

#    def reverse(self, go=5):
#        self.RightMotor.reverse()
#        time.sleep(1)

#    def leftTurnForward(self, go=5):
#        self.RightMotor.forward()
#        time.sleep(1)

#    def rightTurnForward(self, go=5):
#        self.RightMotor.stop()
#        time.sleep(1)

#    def leftTurnReverse(self, go=5):
#        self.RightMotor.reverse()
#        time.sleep(1)

#    def rightTurnReverse(self, go=5):
#        self.RightMotor.stop()
#        time.sleep(1)

#    def leftPivot(self, go=5):
#        self.RightMotor.forward()
#        time.sleep(1)

#    def rightPivot(self, go=5):
#        self.RightMotor.reverse()
#        time.sleep(1)

Left = LeftWheel(LeftMotor=LeftMotor(m1="P9_42"))
#Right = RightWheel(RightMotor=RightMotor(m2="P9_41"))

Left.forward(5)
#Right.forward(5)

Left.reverse(10)
#Right.reverse(5)

#Left.stop(8)
#Right.forward(8)

Left.stop()
#Right.stop()

#GPIO.cleanup()

Okay...I hope that bit of software came in well enough.

I then added this bit of software to handle the classes in the above piece of software.

Oh and this new bit of software was supposed to handle my functions too.




from SinkerOneII import *
import time

m1 = "P9_42"

while True:

    if m1 == 1:
       if Left.forward == 8:
           Left.forward = 8
           time.sleep(2)

    else:
       if Left.forward == 9:
           Left.reverse = 8
           time.sleep(2)
           print("Um...")

left.stop()



Anyway, I think something is up w/ the formatting on this googlegroups site. So be it.

If you are using the LoadCape and understand more of the GPIO process than I obviously do, please reply.

I could use some pointers. I have found many articles relating to GPIO so far. I have tried even more.

I have changed the software many times.

Seth

P.S. If you can point out issues pertaining to my distinct software, reply and let me in on some ideas relating to my lack of knowledge.

Mala Dies

unread,
Dec 23, 2018, 9:08:48 PM12/23/18
to BeagleBoard
Hello Again, 

I updated this software at https://github.com/silver2row/loadcape and it can altered to suit. Outside of that, the single motor or two motors only run and stop and run and stop. I have not been
able to adjust the software to suit the LoadCape w/ GPIO yet for reverse action. I am sure that sending in a web page might be helpful to debug but would rather start simple and then expand.

...

If you know of why this motor w/ GPIO access only moves in a particular manner w/ the software I have available, please do pitch in. I can use a couple of pointers. I will keep on it until I get 
more ideas from research.

Seth

P.S. This is a discussion and announcement, too. I could use help but I would rather give and take. 

Mala Dies

unread,
Dec 24, 2018, 7:30:13 AM12/24/18
to BeagleBoard
Hello Once More,

I was notified that the LoadCape was not geared towards the use of multiple directions for motors. 

Seth

P.S. For now, I am going to trust this idea and move on from multiple directions. 


On Sunday, December 23, 2018 at 1:47:42 PM UTC-6, Mala Dies wrote:
Reply all
Reply to author
Forward
0 new messages