I have some problems with the MotorBridgeCape. I have all my software and I found most of it at GitHub.com at github.com/Seeed-Studio/MotorBridgeCapeforBBG_BBB and at their Wiki at seeedstudio.com/wiki/Motor_Bridge_Cape_v1.0.
Here is my issue. I connect my battery, two motors, and I run the .py file for DC Motors from their Wiki page. I get an error. The error reads as follows: •Error accessing 0x4B: Check your I2C address
I checked online at their site. The seeedstudio.com site, in the forum section, stated that in 2014 there was an addressed answer. This answer was to update the firmware. I go into my BBB/BBG with the MotorBridgeCape attached and I download the .zip file and then unzip it.
The update to the firmware is as follows:
1.Connect cape to your BBG/BBB, download http://www.seeedstudio.com/wiki/images/ ... e_v1.0.zip to your BBG/BBB 2.unzip the file 3.Go to the directory Motor Bridge Cape V1.0 (cd Motor Bridge Cape V1.0) 4.upload firmware (make flash_firmware)
Once I unzip the .zip file, I get a “directory.” The directory is listed as Motor Bridge Cape v1.0. I have no underscores in the file/directory.
So, it is not listed as Motor_Bridge_Cape_v1.0 and I cannot move to that file/directory. So, I used “” to move to that directory.
So, I get to the directory stated and I use “make flash_Firmware”. That gets me errors, too.
Here is the code for the MotorBridgeCapeforBBG_BBB:
Please see:
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
This software above uses the Adafruit_I2C. Is there a way to change Adafruit_I2C to another “import” of GPIOs that does not have a bug?
The I2C import from Adafruit has a bug in it. If I can change the I2C import to import other GPIOs, like GPIO_46 and so on, I should be able to use the MotorBridgeCapeforBBG_BBB in my current code to make things go.
Please see: import MotorBridge import time
MotorName = 1 ClockWise = 1 CounterClockWise = 2 PwmDuty = 90 Frequency = 1000 if __name__=="__main__": motor = MotorBridge.MotorBridgeCape() motor.DCMotorInit(MotorName,Frequency) while True: motor.DCMotorMove(MotorName,ClockWise,PwmDuty) time.sleep(2) motor.DCMotorMove(MotorName,CounterClockWise,PwmDuty) time.sleep(2) print "hello" motor.DCMotorStop(MotorName) time.sleep(2)
Seth
P.S. Any recommendations would be very helpful.
Advertisement
Answer
I changed the line
MotorBridge = Adafruit_I2C(0x4b)
to
MotorBridge = Adafruit_I2C(0x4b,2)
and it worked for me. Also make sure you have python-smbus installed. See this webpage for more information.