Hi!
I had a problem accessing the serial while running my code on Rasberry pi 3 with the BrickPi. When I try to run my code -see below-, Python says:
File "/home/pi/Robocup2015/lib/motor.py", line 18, in move
BrickPiUpdateValues()
File "/usr/local/lib/python2.7/dist-packages/BrickPi-0.0.0-py2.7.egg/BrickPi.py", line 551, in BrickPiUpdateValues
File "/usr/local/lib/python2.7/dist-packages/BrickPi-0.0.0-py2.7.egg/BrickPi.py", line 680, in BrickPiTx
File "/usr/lib/python2.7/dist-packages/serial/serialposix.py", line 485, in write
raise SerialException('write failed: %s' % (v,))
serial.serialutil.SerialException: write failed: [Errno 5] Input/output error
Is the RaspberryPi 3 the problem? Should I use the RaspberryPi 2?
My code is divided in two parts, a class:
from BrickPi import *
import time
class motor:
def setup(self):
BrickPiSetup()
BrickPi.MotorEnable[PORT_A] = 1 #Enable the Motor A
BrickPi.MotorEnable[PORT_B] = 1 #Enable the Motor B
BrickPi.MotorEnable[PORT_C] = 1 #Enable the Motor C
BrickPiSetupSensors()
def move(self, powerA, powerB, powerC):
BrickPi.MotorSpeed[PORT_A] = powerA;
BrickPi.MotorSpeed[PORT_B] = powerB;
BrickPi.MotorSpeed[PORT_C] = powerC;
BrickPiUpdateValues()
and then the invocation:
motor = motor.motor()
motor.setup()
while 1:
motor.move(powerA, powerB, powerC)
In Raspbian Wheezy, did any of the example files work (trying to figure out if it’s an issue with the code you wrote or if it’s an issue with the hardware setup)? If the example files didn’t work, did you try enabling BrickPi communications (http://www.dexterindustries.com/howto/enable-or-disable-brickpi-communications/)?
If not, which version of Raspbian for Robots are you using? What’s the date stamp on it?
Traceback (most recent call last):
File "/home/pi/LEGO-Motor_Test.py", line 35, in <module>
BrickPiUpdateValues() # Ask BrickPi to update values for sensors/motors
File "/usr/local/lib/python2.7/dist-packages/BrickPi-0.0.0-py2.7.egg/BrickPi.py", line 553, in BrickPiUpdateValues
result, BytesReceived, InArray = BrickPiRx(0.007500) #check timeout
File "/usr/local/lib/python2.7/dist-packages/BrickPi-0.0.0-py2.7.egg/BrickPi.py", line 701, in BrickPiRx
while( ser.inWaiting() <= 0):
File "/usr/lib/python2.7/dist-packages/serial/serialposix.py", line 431, in inWaiting
s = fcntl.ioctl(self.fd, TIOCINQ, TIOCM_zero_str)
IOError: [Errno 5] Input/output error
I tried to enable and then disable IR Receiver and it doesn’t work. Now I’ll try to change some settings about the serial port.
At the moment I’ve not here the image I wrote on this USB. I’ll post the date on the image name in a few hours.
I cannot apply the fix however as the current SD-image (Jessie) doesn’t have a “/etc/inittab” file.
I wonder if there are other serial on/off settings that need to be applied to the current build if using a BrickPi? I don’t know/understand enough about how the OS works to start guessing myself.
I will try and test an older SD image tonight so I can apply that fix.
Hi Tim, if you’re using our Jessie Image, we just discovered the problem last night and sent an update. All you need to do is run the update software on the desktop and it should fix this for you. Sorry about the problem!