Please note: Friday June 18 is a holiday celebrating Juneteenth, please allow extra time for your order to arrive and plan accordingly.
0

RE: sudo pip install --upgrade Adafruit_BBIO
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Re: RE: sudo pip install --upgrade Adafruit_BBIO

by silver2row on Fri Feb 16, 2018 3:59 pm

Hello Again,

Sir...MBC.py is my software that was started from a Seeed Studio tutorial and I just kept adding to it. I think I posted the software from MBC.py earlier in our discussion.

Seth

P.S. Please reply or give me any additional instructions if needed.

silver2row
 
Posts: 180
Joined: Sat Jan 30, 2016 3:42 pm

Re: RE: sudo pip install --upgrade Adafruit_BBIO

by silver2row on Fri Feb 16, 2018 4:03 pm

silver2row wrote:
So...the bottom software is the MBC.py. I typed it up but got help from a Wiki from Seeed Studio.

Seth

P.S. Let me know if this helps.

Code: Select all | TOGGLE FULL SIZE
# */
# FileName : MotorBridge.py
# by Jiankai.li

from Adafruit_I2C import Adafruit_I2C
import Adafruit_BBIO.GPIO as GPIO
import time
Reset = "P9_23"
MotorBridge = Adafruit_I2C(0x4b)
GPIO.setup(Reset, GPIO.OUT)

ReadMode  = 0
WriteMode = 1
DeAddr    = 0X4B
ConfigValid =  0x3a6fb67c
DelayTime = 0.005

# TB_WORKMODE

TB_SHORT_BREAK  = 0
TB_CW           = 1
TB_CCW          = 2
TB_STOP         = 3
TB_WORKMODE_NUM = 4


# TB_PORTMODE

TB_DCM          = 0
TB_SPM          = 1
TB_PORTMODE_NUM = 2


# SVM_PORT

SVM1            = 0
SVM2            = 1
SVM3            = 2
SVM4            = 3
SVM5            = 4
SVM6            = 5
SVM_PORT_NUM    = 6

# SVM_STATE

SVM_DISABLE     = 0
SVM_ENABLE      = 1
SVM_STATE_NUM   = 2

# IO_MODE

IO_IN           = 0
IO_OUT          = 1
IO_MODE_NUM     = 2

# IO_PUPD

IO_PU           = 0
IO_PD           = 1
IO_NP           = 2
IO_PUPD_NUM     = 3

# IO_PPOD

IO_PP           = 0
IO_OD           = 1
IO_PPOD_NUM     = 2

# IO_STATE

IO_LOW          = 0
IO_HIGH         = 1
IO_STATE_NUM    = 2

# IO_PORT

IO1             = 0
IO2             = 1
IO3             = 2
IO4             = 3
IO5             = 4
IO6             = 5
IO_NUM          = 6


# PARAM_REG

CONFIG_VALID        = 0 
CONFIG_TB_PWM_FREQ  = CONFIG_VALID + 4
 
I2C_ADDRESS         = CONFIG_TB_PWM_FREQ + 4
 
TB_1A_MODE          = I2C_ADDRESS + 1
TB_1A_DIR           = TB_1A_MODE + 1
TB_1A_DUTY          = TB_1A_DIR + 1
TB_1A_SPM_SPEED     = TB_1A_DUTY + 2
TB_1A_SPM_STEP      = TB_1A_SPM_SPEED + 4
 
TB_1B_MODE          = TB_1A_SPM_STEP + 4
TB_1B_DIR           = TB_1B_MODE + 1
TB_1B_DUTY          = TB_1B_DIR + 1
TB_1B_SPM_SPEED     = TB_1B_DUTY + 2
TB_1B_SPM_STEP      = TB_1B_SPM_SPEED + 4
 
TB_2A_MODE          = TB_1B_SPM_STEP + 4
TB_2A_DIR           = TB_2A_MODE + 1
TB_2A_DUTY          = TB_2A_DIR + 1
TB_2A_SPM_SPEED     = TB_2A_DUTY + 2
TB_2A_SPM_STEP      = TB_2A_SPM_SPEED + 4
 
TB_2B_MODE          = TB_2A_SPM_STEP + 4
TB_2B_DIR           = TB_2B_MODE + 1
TB_2B_DUTY          = TB_2B_DIR + 1
TB_2B_SPM_SPEED     = TB_2B_DUTY + 2
TB_2B_SPM_STEP      = TB_2B_SPM_SPEED + 4

SVM1_STATE          = TB_2B_SPM_STEP + 4
SVM1_FREQ           = SVM1_STATE + 1
SVM1_ANGLE          = SVM1_FREQ + 2
 
SVM2_STATE          = SVM1_ANGLE + 2
SVM2_FREQ           = SVM2_STATE + 1
SVM2_ANGLE          = SVM2_FREQ + 2
 
SVM3_STATE          = SVM2_ANGLE + 2
SVM3_FREQ           = SVM3_STATE + 1
SVM3_ANGLE          = SVM3_FREQ + 2
 
SVM4_STATE          = SVM3_ANGLE + 2
SVM4_FREQ           = SVM4_STATE + 1
SVM4_ANGLE          = SVM4_FREQ + 2
 
SVM5_STATE          = SVM4_ANGLE + 2
SVM5_FREQ           = SVM5_STATE + 1
SVM5_ANGLE          = SVM5_FREQ + 2
 
SVM6_STATE          = SVM5_ANGLE + 2
SVM6_FREQ           = SVM6_STATE + 1
SVM6_ANGLE          = SVM6_FREQ + 2

IO1_STATE           = SVM6_ANGLE + 2
IO1_MODE            = IO1_STATE + 1
IO1_PUPD            = IO1_MODE + 1
IO1_PPOD            = IO1_PUPD + 1

IO2_STATE           = IO1_PPOD + 1
IO2_MODE            = IO2_STATE + 1
IO2_PUPD            = IO2_MODE + 1
IO2_PPOD            = IO2_PUPD + 1
 
IO3_STATE           = IO2_PPOD + 1
IO3_MODE            = IO3_STATE + 1
IO3_PUPD            = IO3_MODE + 1
IO3_PPOD            = IO3_PUPD + 1
 
IO4_STATE           = IO3_PPOD + 1
IO4_MODE            = IO4_STATE + 1
IO4_PUPD            = IO4_MODE + 1
IO4_PPOD            = IO4_PUPD + 1
 
IO5_STATE           = IO4_PPOD + 1
IO5_MODE            = IO5_STATE + 1
IO5_PUPD            = IO5_MODE + 1
IO5_PPOD            = IO5_PUPD + 1
 
IO6_STATE           = IO5_PPOD + 1
IO6_MODE            = IO6_STATE + 1
IO6_PUPD            = IO6_MODE + 1
IO6_PPOD            = IO6_PUPD + 1

PARAM_REG_NUM = IO6_PPOD + 1

def WriteByte(Reg,Value):
    data = [0 for i in range(2)]
    data[0] = Reg
    data[1] = Value
    MotorBridge.writeList(WriteMode,data)

def WriteHalfWord(Reg,Value):
    data = [0 for i in range(3)]
    data[0] = Reg
    data[1] = Value & 0xff
    data[2] = (Value>>8) & 0xff
    MotorBridge.writeList(WriteMode,data)
   
def WriteOneWord(Reg,Value):
    data = [0 for i in range(5)]
    data[0] = Reg
    data[1] = Value & 0xff
    data[2] = (Value>>8) & 0xff
    data[3] = (Value>>16) & 0xff
    data[4] = (Value>>24) & 0xff
    MotorBridge.writeList(WriteMode,data)

def SetDefault():
    WriteOneWord(CONFIG_VALID,0x00000000)

class MotorBridgeCape:
    def __init__(self):
        GPIO.output(Reset, GPIO.HIGH)
        time.sleep(1)
       
    # init stepper motor A
    def StepperMotorAInit(self):
        WriteByte(TB_1A_MODE,TB_SPM) #Stepper
        time.sleep(DelayTime)
        WriteHalfWord(TB_1A_DUTY,1000)    # voltage
        time.sleep(DelayTime)
       
    # MoveSteps > 0 CW
    # MoveSteps < 0 CCW
    # StepDelayTime : delay time for every step. uint us
    def StepperMotorAMove(self,MoveSteps,StepDelayTime):
        if MoveSteps > 0:
            WriteByte(TB_1A_DIR,TB_CW)   #CW
        else:
            WriteByte(TB_1A_DIR,TB_CCW)   #CW
            MoveSteps = -MoveSteps
        time.sleep(DelayTime)   
        WriteOneWord(TB_1A_SPM_SPEED,StepDelayTime)  # unit us
        time.sleep(DelayTime)
        WriteOneWord(TB_1A_SPM_STEP,MoveSteps)
        time.sleep(DelayTime)
       
       
    # init stepper motor B
    def StepperMotorBInit(self):
        WriteByte(TB_2A_MODE,TB_SPM) #Stepper
        time.sleep(DelayTime)
        WriteHalfWord(TB_2A_DUTY,1000)    # voltage
        time.sleep(DelayTime)
       
    # MoveSteps > 0 CW
    # MoveSteps < 0 CCW
    # StepDelayTime : delay time for every step. uint us
    def StepperMotorBMove(self,MoveSteps,StepDelayTime):
        if MoveSteps > 0:
            WriteByte(TB_2A_DIR,TB_CW)   #CW
        else:
            WriteByte(TB_2A_DIR,TB_CCW)   #CW
            MoveSteps = -MoveSteps
        time.sleep(DelayTime)   
        WriteOneWord(TB_2A_SPM_SPEED,StepDelayTime)  # unit us
        time.sleep(DelayTime)
        WriteOneWord(TB_2A_SPM_STEP,MoveSteps)
        time.sleep(DelayTime)
       
    # Init DC Motor
    def DCMotorInit(self,MotorName,Frequency):
    # Init the DC Frequency
        WriteOneWord(CONFIG_TB_PWM_FREQ,Frequency)
        time.sleep(DelayTime)
       
    # Set the port as DC Motor
        if MotorName == 1 or MotorName == 2:
            WriteByte(TB_1A_MODE,TB_DCM)
            time.sleep(DelayTime)
            WriteByte(TB_1A_DIR,TB_STOP)
            time.sleep(DelayTime)
            WriteByte(TB_1B_MODE,TB_DCM)
            time.sleep(DelayTime)
            WriteByte(TB_1B_DIR,TB_STOP)
            time.sleep(DelayTime)
        if MotorName == 3 or MotorName == 4:
            WriteByte(TB_2A_MODE,TB_DCM)
            time.sleep(DelayTime)
            WriteByte(TB_2A_DIR,TB_STOP)
            time.sleep(DelayTime)
            WriteByte(TB_2B_MODE,TB_DCM)
            time.sleep(DelayTime)
            WriteByte(TB_2B_DIR,TB_STOP)
            time.sleep(DelayTime)
           
    # Drive the DC Motor
    # Direction 1 CW | 2 CCW
    # PWNDuty  0 ~ 100
    def DCMotorMove(self, MotorName,Direction,PWMDuty):
        if MotorName == 1:
            WriteByte(TB_1B_DIR,Direction)
            time.sleep(DelayTime)
            WriteOneWord(TB_1B_DUTY,PWMDuty*10)
            time.sleep(DelayTime)
           
        if MotorName == 2:
            WriteByte(TB_1A_DIR,Direction)
            time.sleep(DelayTime)
            WriteOneWord(TB_1A_DUTY,PWMDuty*10)
            time.sleep(DelayTime)
           
        if MotorName == 3:
            WriteByte(TB_2B_DIR,Direction)
            time.sleep(DelayTime)
            WriteOneWord(TB_2B_DUTY,PWMDuty*10)
            time.sleep(DelayTime)

        if MotorName == 4:
            WriteByte(TB_2A_DIR,Direction)
            time.sleep(DelayTime)
            WriteOneWord(TB_2A_DUTY,PWMDuty*10)     
            time.sleep(DelayTime)
           
    # Stop the DC motor
    def DCMotorStop(self, MotorName):
        if MotorName == 1:
            WriteByte(TB_1B_DIR,TB_STOP)
        if MotorName == 2:
            WriteByte(TB_1A_DIR,TB_STOP)
        if MotorName == 3:
            WriteByte(TB_2B_DIR,TB_STOP)
        if MotorName == 4:
            WriteByte(TB_2A_DIR,TB_STOP)   
        time.sleep(DelayTime)
   
    # init the Servo
    def ServoInit(self,ServoName,Frequency):
        if ServoName == 1:
            WriteHalfWord(SVM1_FREQ,Frequency)
            time.sleep(DelayTime)       
            WriteByte(SVM1_STATE,SVM_ENABLE)
            time.sleep(DelayTime)

        if ServoName == 2:
            WriteHalfWord(SVM2_FREQ,Frequency) 
            time.sleep(DelayTime)
            WriteByte(SVM2_STATE,SVM_ENABLE)
            time.sleep(DelayTime)
        if ServoName == 3:
            WriteHalfWord(SVM3_FREQ,Frequency)
            time.sleep(DelayTime)       
            WriteByte(SVM3_STATE,SVM_ENABLE)
            time.sleep(DelayTime)

        if ServoName == 4:
            WriteHalfWord(SVM4_FREQ,Frequency) 
            time.sleep(DelayTime)
            WriteByte(SVM4_STATE,SVM_ENABLE)
            time.sleep(DelayTime)
        if ServoName == 5:
            WriteHalfWord(SVM5_FREQ,Frequency)
            time.sleep(DelayTime)       
            WriteByte(SVM5_STATE,SVM_ENABLE)
            time.sleep(DelayTime)

        if ServoName == 6:
            WriteHalfWord(SVM6_FREQ,Frequency) 
            time.sleep(DelayTime)
            WriteByte(SVM6_STATE,SVM_ENABLE)
            time.sleep(DelayTime)
             
    def ServoMoveAngle(self,ServoName,Angle):
        if ServoName == 1:
            WriteHalfWord(SVM1_ANGLE,Angle)
            time.sleep(DelayTime)

        if ServoName == 2:
            WriteHalfWord(SVM2_ANGLE,Angle)   
            time.sleep(DelayTime)
           
        if ServoName == 3:
            WriteHalfWord(SVM3_ANGLE,Angle)
            time.sleep(DelayTime)

        if ServoName == 4:
            WriteHalfWord(SVM4_ANGLE,Angle)   
            time.sleep(DelayTime)     
           
        if ServoName == 5:
            WriteHalfWord(SVM5_ANGLE,Angle)
            time.sleep(DelayTime)

        if ServoName == 6:
            WriteHalfWord(SVM6_ANGLE,Angle)   
            time.sleep(DelayTime)   
           
def myloop():
    print 'Hello From MotorBridge'
    time.sleep(1)
    motor.StepperMotorBMove(-1000,1000) # 20 steppers  1000us every step
    time.sleep(1)
    motor.StepperMotorBMove(1000,1000)  # 20 steppers  1000us every step
    myloop()


if __name__=="__main__":
   
    motor = MotorBridgeCape()
    motor.StepperMotorBInit()
    motor.StepperMotorBMove(1000,1000) # 20 steppers  1000us every step
    myloop()


and...here is my idea of software.

Code: Select all | TOGGLE FULL SIZE
import MotorBridge
import time

MotorName        = 1
MotorName        = 3
ClockWise        = 1
CounterClockWise = 2
PwmDuty          = 90
Frequency        = 1000

if __name__=="__main__":
    motor = MotorBridge.MotorBridgeCape()
    motor.DCMotorInit(1, 1000)
    motor.DCMotorInit(3, 1000)
    for i in range(1, 51):
        motor.DCMotorMove(1, 1, 90)
        motor.DCMotorMove(3, 1, 90)
        print "I got your biscuit, now!"

#Making a U-Shape in the lawn
#Left motor on chassis goes while the right motor ccw
    motor = MotorBridge.MotorBridgeCape()
    motor.DCMotorInit(1, 1000)
    motor.DCMotorInit(3, 1000)
    for i in range(1, 3):
        motor.DCMotorMove(1, 1, 90)
        motor.DCMotorMove(3, 2, 90)
        print "I love Jim's TURN!"

#All Flanks...Straight Ahead!       
    motor = MotorBridge.MotorBridgeCape()
    motor.DCMotorInit(1, 1000)
    motor.DCMotorInit(3, 1000)
    for i in range(1, 51):
        motor.DCMotorMove(1, 1, 90)
        motor.DCMotorMove(3, 1, 90)
        print "Give in to temptation!"
       
#Make another U-Turn but this time, motors go in the opposite direction!
    motor = MotorBridge.MotorBridgeCape()
    motor.DCMotorInit(1, 1000)
    motor.DCMotorInit(3, 1000)
    for i in range(1, 3):
        motor.DCMotorMove(1, 2, 90)
        motor.DCMotorMove(3, 1, 90)
       
#Straight Ahead
    motor = MotorBridge.MotorBridgeCape()
    motor.DCMotorInit(1, 1000)
    motor.DCMotorInit(3, 1000)
    for i in range(1, 51):
        motor.DCMotorMove(1, 1, 90)
        motor.DCMotorMove(3, 1, 90)
        print "Tacos are not all around here!"
       
    motor = MotorBridge.MotorBridgeCape()
    motor.DCMotorInit(1, 1000)
    motor.DCMotorInit(3, 1000)
    for i in range(1, 3):
        motor.DCMotorMove(1, 1, 90)
        motor.DCMotorMove(3, 2, 90)
   
    motor = MotorBridge.MotorBridgeCape()
    motor.DCMotorInit(1, 1000)
    motor.DCMotorInit(3, 1000)
    for i in range(1, 51):
        motor.DCMotorMove(1, 1, 90)
        motor.DCMotorMove(3, 1, 90)   
   
    motor = MotorBridge.MotorBridgeCape()
    motor.DCMotorInit(1, 1000)
    motor.DCMotorInit(3, 1000)
    for i in range(1, 3):
        motor.DCMotorMove(1, 2, 90)
        motor.DCMotorMove(3, 1, 90)
   
    motor = MotorBridge.MotorBridgeCape()
    motor.DCMotorInit(1, 1000)
    motor.DCMotorInit(3, 1000)
    for i in range(1, 51):
        motor.DCMotorMove(1, 1, 90)
        motor.DCMotorMove(3, 1, 90)

    motor = MotorBridge.MotorBridgeCape()
    motor.DCMotorInit(1, 1000)
    motor.DCMotorInit(3, 1000)
    for i in range(1, 3):
        motor.DCMotorMove(1, 1, 90)
        motor.DCMotorMove(3, 2, 90)

    motor = MotorBridge.MotorBridgeCape()
    motor.DCMotorInit(1, 1000)
    motor.DCMotorInit(3, 1000)
    for i in range(1, 51):
        motor.DCMotorMove(1, 1, 90)
        motor.DCMotorMove(3, 1, 90)       

    motor = MotorBridge.MotorBridgeCape()
    motor.DCMotorInit(1, 1000)
    motor.DCMotorInit(3, 1000)
    for i in range(1, 3):
        motor.DCMotorMove(1, 2, 90)
        motor.DCMotorMove(3, 1, 90)
       
    motor = MotorBridge.MotorBridgeCape()
    motor.DCMotorInit(1, 1000)
    motor.DCMotorInit(3, 1000)
    for i in range(1, 51):
        motor.DCMotorMove(1, 1, 90)
        motor.DCMotorMove(3, 1, 90)



This is the MBC.py software that I wrote but Seeed Studio had a Wiki. That Wiki helped me start out.

silver2row
 
Posts: 180
Joined: Sat Jan 30, 2016 3:42 pm

Re: RE: sudo pip install --upgrade Adafruit_BBIO

by silver2row on Fri Feb 16, 2018 4:33 pm

Hello Sir,

I thought of one more thing. Usually w/ my MotorBridge.py software from Seeed Studio, I have to install python-smbus. I looked at my command dpkg -l and realized that python-smbus is not installed on my system.

I tried to install it and the system failed me. Is python-smbus not available w/ kernel 4.9.x. I am using python 2.7 instead of python 3.

Seth

P.S. If this matters, please let me know.
Attachments
smbus.JPG
Not able to find python-smbus on my system...
smbus.JPG (38.02 KiB) Viewed 653 times

silver2row
 
Posts: 180
Joined: Sat Jan 30, 2016 3:42 pm

Re: RE: sudo pip install --upgrade Adafruit_BBIO

by silver2row on Fri Feb 16, 2018 4:38 pm

Hello Sir,

I realized too late that python-smbus does not exist anymore and it is needed w/ ,"I thought," python 2.7-Adafruit_BBIO stuff for I2C.

Seth

P.S. I have always had to get python-smbus for the MotorBridgeCape use.
Last edited by silver2row on Fri Feb 16, 2018 8:38 pm, edited 1 time in total.

silver2row
 
Posts: 180
Joined: Sat Jan 30, 2016 3:42 pm

Re: RE: sudo pip install --upgrade Adafruit_BBIO

by silver2row on Fri Feb 16, 2018 4:52 pm

Hello Sir,

I know I am giving you a bunch of stuff to read and look over that may not have anything to do w/ what you normally work on. Please forgive me. See here: https://www.linuxcircle.com/2015/05/03/ ... -python-3/.

I installed python3-smbus, libi2c-dev and received the same errors from when running MBC.py, this my software to make my machinery work, on Python 3 on the BBG. That is just an update.

That is all, sir.

Seth

silver2row
 
Posts: 180
Joined: Sat Jan 30, 2016 3:42 pm

Re: RE: sudo pip install --upgrade Adafruit_BBIO

by drewfustini on Fri Feb 16, 2018 9:21 pm

python-smbus does exist in Debian 9.3 (Stretch):
Code: Select all | TOGGLE FULL SIZE
debian@beaglebone:~$ apt-cache search python-smbus
python-smbus - Python bindings for Linux SMBus access through i2c-dev

debian@beaglebone:~$ dpkg -l |grep smbus
ii  python-smbus:armhf                    3.1.2-3                                       armhf        Python bindings for Linux SMBus access through i2c-dev

debian@beaglebone:~$ dpkg -L python-smbus
/.
/usr
/usr/lib
/usr/lib/python2.7
/usr/lib/python2.7/dist-packages
/usr/lib/python2.7/dist-packages/smbus.arm-linux-gnueabihf.so
/usr/share
/usr/share/doc
/usr/share/doc/python-smbus
/usr/share/doc/python-smbus/changelog.Debian.gz
/usr/share/doc/python-smbus/changelog.gz
/usr/share/doc/python-smbus/copyright


Please try running:
Code: Select all | TOGGLE FULL SIZE
sudo apt-get update && sudo apt-get install python-smbus

drewfustini
 
Posts: 944
Joined: Sat Dec 26, 2015 1:19 pm

Re: RE: sudo pip install --upgrade Adafruit_BBIO

by silver2row on Fri Feb 16, 2018 9:36 pm

Hello,

That is so odd. I tried it earlier. It would not apt-get me a python-smbus.

Seth

P.S. Weird days, man. Thank you. I will get back to you.

silver2row
 
Posts: 180
Joined: Sat Jan 30, 2016 3:42 pm

Re: RE: sudo pip install --upgrade Adafruit_BBIO

by silver2row on Fri Feb 16, 2018 9:39 pm

Hello,

This is my output on the terminal screen when I run my software, mbcUse.py:

Code: Select all | TOGGLE FULL SIZE
debian@beaglebone:~/MotorBridgeCapeforBBG_BBB/BBG_MotorBridgeCape$ sudo nano MotorBridge.py
debian@beaglebone:~/MotorBridgeCapeforBBG_BBB/BBG_MotorBridgeCape$ sudo python mbcUse.py
WARNING: THIS MODULE IS DEPRECATED. Use Adafruit_GPIO.I2C instead.

Traceback (most recent call last):
  File "mbcUse.py", line 13, in <module>
    motor.DCMotorInit(1, 1000)
  File "/home/debian/MotorBridgeCapeforBBG_BBB/BBG_MotorBridgeCape/MotorBridge.py", line 279, in DCMotorInit
    WriteOneWord(CONFIG_TB_PWM_FREQ,Frequency)
  File "/home/debian/MotorBridgeCapeforBBG_BBB/BBG_MotorBridgeCape/MotorBridge.py", line 221, in WriteOneWord
    MotorBridge.writeList(WriteMode,data)
AttributeError: Adafruit_I2C instance has no attribute 'writeList'
debian@beaglebone:~/MotorBridgeCapeforBBG_BBB/BBG_MotorBridgeCape$


Seth

P.S. If this helps, okay. If not, dang it!

silver2row
 
Posts: 180
Joined: Sat Jan 30, 2016 3:42 pm

Re: RE: sudo pip install --upgrade Adafruit_BBIO

by drewfustini on Sun Feb 18, 2018 3:30 am

Is mbcUse.py different than MBC.py?

If so, then post the code in a reply.

Here are my results running your MBC.py script with no modifcations to the Seeed's MotorBridge.py file:

Code: Select all | TOGGLE FULL SIZE
debian@beaglebone:~/tmp/MotorBridgeCapeforBBG_BBB/BBG_MotorBridgeCape$ sudo python MBC.py
Error accessing 0x4B: Check your I2C address
Error accessing 0x4B: Check your I2C address
Error accessing 0x4B: Check your I2C address
Error accessing 0x4B: Check your I2C address
Error accessing 0x4B: Check your I2C address
Error accessing 0x4B: Check your I2C address
Error accessing 0x4B: Check your I2C address
Error accessing 0x4B: Check your I2C address
Error accessing 0x4B: Check your I2C address
Error accessing 0x4B: Check your I2C address
Error accessing 0x4B: Check your I2C address
Error accessing 0x4B: Check your I2C address
Error accessing 0x4B: Check your I2C address
Error accessing 0x4B: Check your I2C address
I got your biscuit, now!
Error accessing 0x4B: Check your I2C address
Error accessing 0x4B: Check your I2C address
Error accessing 0x4B: Check your I2C address
Error accessing 0x4B: Check your I2C address
I got your biscuit, now!
Error accessing 0x4B: Check your I2C address
Error accessing 0x4B: Check your I2C address
Error accessing 0x4B: Check your I2C address
Error accessing 0x4B: Check your I2C address
I got your biscuit, now!
Error accessing 0x4B: Check your I2C address
Error accessing 0x4B: Check your I2C address
Error accessing 0x4B: Check your I2C address
Error accessing 0x4B: Check your I2C address
I got your biscuit, now!
Error accessing 0x4B: Check your I2C address
Error accessing 0x4B: Check your I2C address
Error accessing 0x4B: Check your I2C address
Error accessing 0x4B: Check your I2C address
I got your biscuit, now!
Error accessing 0x4B: Check your I2C address
Error accessing 0x4B: Check your I2C address
Error accessing 0x4B: Check your I2C address
Error accessing 0x4B: Check your I2C address
I got your biscuit, now!
^CTraceback (most recent call last):
  File "MBC.py", line 22, in <module>
    motor = MotorBridge.MotorBridgeCape()
  File "/home/debian/tmp/MotorBridgeCapeforBBG_BBB/BBG_MotorBridgeCape/MotorBridge.py", line 229, in __init__
    time.sleep(1)
KeyboardInterrupt
debian@beaglebone:~/tmp/MotorBridgeCapeforBBG_BBB/BBG_MotorBridgeCape$ cat MBC.py
import MotorBridge
import time

MotorName        = 1
MotorName        = 3
ClockWise        = 1
CounterClockWise = 2
PwmDuty          = 90
Frequency        = 1000

if __name__=="__main__":
    motor = MotorBridge.MotorBridgeCape()
    motor.DCMotorInit(1, 1000)
    motor.DCMotorInit(3, 1000)
    for i in range(1, 51):
        motor.DCMotorMove(1, 1, 90)
        motor.DCMotorMove(3, 1, 90)
        print "I got your biscuit, now!"

#Making a U-Shape in the lawn
#Left motor on chassis goes while the right motor ccw
    motor = MotorBridge.MotorBridgeCape()
    motor.DCMotorInit(1, 1000)
    motor.DCMotorInit(3, 1000)
    for i in range(1, 3):
        motor.DCMotorMove(1, 1, 90)
        motor.DCMotorMove(3, 2, 90)
        print "I love Jim's TURN!"

#All Flanks...Straight Ahead!       
    motor = MotorBridge.MotorBridgeCape()
    motor.DCMotorInit(1, 1000)
    motor.DCMotorInit(3, 1000)
    for i in range(1, 51):
        motor.DCMotorMove(1, 1, 90)
        motor.DCMotorMove(3, 1, 90)
        print "Give in to temptation!"
       
#Make another U-Turn but this time, motors go in the opposite direction!
    motor = MotorBridge.MotorBridgeCape()
    motor.DCMotorInit(1, 1000)
    motor.DCMotorInit(3, 1000)
    for i in range(1, 3):
        motor.DCMotorMove(1, 2, 90)
        motor.DCMotorMove(3, 1, 90)
       
#Straight Ahead
    motor = MotorBridge.MotorBridgeCape()
    motor.DCMotorInit(1, 1000)
    motor.DCMotorInit(3, 1000)
    for i in range(1, 51):
        motor.DCMotorMove(1, 1, 90)
        motor.DCMotorMove(3, 1, 90)
        print "Tacos are not all around here!"
       
    motor = MotorBridge.MotorBridgeCape()
    motor.DCMotorInit(1, 1000)
    motor.DCMotorInit(3, 1000)
    for i in range(1, 3):
        motor.DCMotorMove(1, 1, 90)
        motor.DCMotorMove(3, 2, 90)
   
    motor = MotorBridge.MotorBridgeCape()
    motor.DCMotorInit(1, 1000)
    motor.DCMotorInit(3, 1000)
    for i in range(1, 51):
        motor.DCMotorMove(1, 1, 90)
        motor.DCMotorMove(3, 1, 90)   
   
    motor = MotorBridge.MotorBridgeCape()
    motor.DCMotorInit(1, 1000)
    motor.DCMotorInit(3, 1000)
    for i in range(1, 3):
        motor.DCMotorMove(1, 2, 90)
        motor.DCMotorMove(3, 1, 90)
   
    motor = MotorBridge.MotorBridgeCape()
    motor.DCMotorInit(1, 1000)
    motor.DCMotorInit(3, 1000)
    for i in range(1, 51):
        motor.DCMotorMove(1, 1, 90)
        motor.DCMotorMove(3, 1, 90)

    motor = MotorBridge.MotorBridgeCape()
    motor.DCMotorInit(1, 1000)
    motor.DCMotorInit(3, 1000)
    for i in range(1, 3):
        motor.DCMotorMove(1, 1, 90)
        motor.DCMotorMove(3, 2, 90)

    motor = MotorBridge.MotorBridgeCape()
    motor.DCMotorInit(1, 1000)
    motor.DCMotorInit(3, 1000)
    for i in range(1, 51):
        motor.DCMotorMove(1, 1, 90)
        motor.DCMotorMove(3, 1, 90)       

    motor = MotorBridge.MotorBridgeCape()
    motor.DCMotorInit(1, 1000)
    motor.DCMotorInit(3, 1000)
    for i in range(1, 3):
        motor.DCMotorMove(1, 2, 90)
        motor.DCMotorMove(3, 1, 90)
       
    motor = MotorBridge.MotorBridgeCape()
    motor.DCMotorInit(1, 1000)
    motor.DCMotorInit(3, 1000)
    for i in range(1, 51):
        motor.DCMotorMove(1, 1, 90)
        motor.DCMotorMove(3, 1, 90)

drewfustini
 
Posts: 944
Joined: Sat Dec 26, 2015 1:19 pm

Re: RE: sudo pip install --upgrade Adafruit_BBIO

by silver2row on Sun Feb 18, 2018 7:44 pm

Hello Sir,

mbcUse.py and MBC.py are the exact same software examples. I am doing something wrong. I will attempt to go back to the page and update my system. I will then add all required packages and then run the MBC.py/mbcUse.py software.

Seth

P.S. I think I may have figured out u-boot overlays. I took some time off of the BBB and got left in the dust. I was unaware of u-boot overlays. I see on my current image, my u-boot overlay has all the UART connections enabled. The i2c issues you are coming across only needs a "2" added to MotorBridge.py at MotorBridge = Adafruit_I2C(0x4b). So it would read MotorBridge = Adafruit_I2C(0x4b, 2) instead.

silver2row
 
Posts: 180
Joined: Sat Jan 30, 2016 3:42 pm

Re: RE: sudo pip install --upgrade Adafruit_BBIO

by silver2row on Sun Feb 18, 2018 7:46 pm

Sir,

Here is the software you requested. This is the mbcUse.py/MBC.py software example.

Code: Select all | TOGGLE FULL SIZE
import MotorBridge
import time

MotorName        = 1
MotorName        = 3
ClockWise        = 1
CounterClockWise = 2
PwmDuty          = 90
Frequency        = 1000

if __name__=="__main__":
    motor = MotorBridge.MotorBridgeCape()
    motor.DCMotorInit(1, 1000)
    motor.DCMotorInit(3, 1000)
    for i in range(1, 51):
        motor.DCMotorMove(1, 1, 90)
        motor.DCMotorMove(3, 1, 90)
        print "I got your biscuit, now!"

#Making a U-Shape in the lawn
#Left motor on chassis goes while the right motor ccw
    motor = MotorBridge.MotorBridgeCape()
    motor.DCMotorInit(1, 1000)
    motor.DCMotorInit(3, 1000)
    for i in range(1, 3):
        motor.DCMotorMove(1, 1, 90)
        motor.DCMotorMove(3, 2, 90)
        print "I love Jim's TURN!"

#All Flanks...Straight Ahead!       
    motor = MotorBridge.MotorBridgeCape()
    motor.DCMotorInit(1, 1000)
    motor.DCMotorInit(3, 1000)
    for i in range(1, 51):
        motor.DCMotorMove(1, 1, 90)
        motor.DCMotorMove(3, 1, 90)
        print "Give in to temptation!"
       
#Make another U-Turn but this time, motors go in the opposite direction!
    motor = MotorBridge.MotorBridgeCape()
    motor.DCMotorInit(1, 1000)
    motor.DCMotorInit(3, 1000)
    for i in range(1, 3):
        motor.DCMotorMove(1, 2, 90)
        motor.DCMotorMove(3, 1, 90)
       
#Straight Ahead
    motor = MotorBridge.MotorBridgeCape()
    motor.DCMotorInit(1, 1000)
    motor.DCMotorInit(3, 1000)
    for i in range(1, 51):
        motor.DCMotorMove(1, 1, 90)
        motor.DCMotorMove(3, 1, 90)
        print "Tacos are not all around here!"
       
    motor = MotorBridge.MotorBridgeCape()
    motor.DCMotorInit(1, 1000)
    motor.DCMotorInit(3, 1000)
    for i in range(1, 3):
        motor.DCMotorMove(1, 1, 90)
        motor.DCMotorMove(3, 2, 90)
   
    motor = MotorBridge.MotorBridgeCape()
    motor.DCMotorInit(1, 1000)
    motor.DCMotorInit(3, 1000)
    for i in range(1, 51):
        motor.DCMotorMove(1, 1, 90)
        motor.DCMotorMove(3, 1, 90)   
   
    motor = MotorBridge.MotorBridgeCape()
    motor.DCMotorInit(1, 1000)
    motor.DCMotorInit(3, 1000)
    for i in range(1, 3):
        motor.DCMotorMove(1, 2, 90)
        motor.DCMotorMove(3, 1, 90)
   
    motor = MotorBridge.MotorBridgeCape()
    motor.DCMotorInit(1, 1000)
    motor.DCMotorInit(3, 1000)
    for i in range(1, 51):
        motor.DCMotorMove(1, 1, 90)
        motor.DCMotorMove(3, 1, 90)

    motor = MotorBridge.MotorBridgeCape()
    motor.DCMotorInit(1, 1000)
    motor.DCMotorInit(3, 1000)
    for i in range(1, 3):
        motor.DCMotorMove(1, 1, 90)
        motor.DCMotorMove(3, 2, 90)

    motor = MotorBridge.MotorBridgeCape()
    motor.DCMotorInit(1, 1000)
    motor.DCMotorInit(3, 1000)
    for i in range(1, 51):
        motor.DCMotorMove(1, 1, 90)
        motor.DCMotorMove(3, 1, 90)       

    motor = MotorBridge.MotorBridgeCape()
    motor.DCMotorInit(1, 1000)
    motor.DCMotorInit(3, 1000)
    for i in range(1, 3):
        motor.DCMotorMove(1, 2, 90)
        motor.DCMotorMove(3, 1, 90)
       
    motor = MotorBridge.MotorBridgeCape()
    motor.DCMotorInit(1, 1000)
    motor.DCMotorInit(3, 1000)
    for i in range(1, 51):
        motor.DCMotorMove(1, 1, 90)
        motor.DCMotorMove(3, 1, 90)


Seth

P.S. That should do it after you make the addition to the MotorBridge.py software.

silver2row
 
Posts: 180
Joined: Sat Jan 30, 2016 3:42 pm

Re: RE: sudo pip install --upgrade Adafruit_BBIO

by silver2row on Sun Feb 18, 2018 8:24 pm

Hello Again,

Sir...what version of Adafruit_BBIO are you running on your system. I am running 1.0.10.

Seth

silver2row
 
Posts: 180
Joined: Sat Jan 30, 2016 3:42 pm

Re: RE: sudo pip install --upgrade Adafruit_BBIO

by drewfustini on Mon Feb 19, 2018 2:54 am

silver2row wrote:Hello Again,

Sir...what version of Adafruit_BBIO are you running on your system. I am running 1.0.10.

Seth


I am running that version as well. It is the most recent version.

drewfustini
 
Posts: 944
Joined: Sat Dec 26, 2015 1:19 pm

Re: RE: sudo pip install --upgrade Adafruit_BBIO

by drewfustini on Mon Feb 19, 2018 3:07 am

I would suggest that you fork the Seeed Studio MotorBridgeCapeforBBG_BBB repo. You can then add your files to the forked repo and push it to GitHub.

This will make it easier for others to see the changes you've made and reproduce errors that you experience.

drewfustini
 
Posts: 944
Joined: Sat Dec 26, 2015 1:19 pm

Re: RE: sudo pip install --upgrade Adafruit_BBIO

by silver2row on Mon Feb 19, 2018 6:46 pm

Yes Sir,

I am on it. Thank you for your help so far. I will add it to my repos and then make corrections. Wait...I have it in my repos. I will do some work on it.

Seth

silver2row
 
Posts: 180
Joined: Sat Jan 30, 2016 3:42 pm

Please be positive and constructive with your questions and comments.