Arm_test.py problems

Hello Everyone,

I am running the arm_test.py python file of bookreader2 on a BrickPi3. When I run the code, I get an error

 ===========
Traceback (most recent call last):
  File "/home/pi/Software/BrickPi_Python/arm_test.py", line 42, in <module>
    if(BrickPi.Encoder[arm]-init_pos>710):
TypeError: unsupported operand type(s) for -: 'NoneType' and 'NoneType'
>>> 

A portion of the code where the error occurred is shown below:

while True:
		BrickPiUpdateValues()     
		if(BrickPi.Encoder[arm]-init_pos>710):
			BrickPi.MotorSpeed[arm] = -85
			BrickPiUpdateValues()
			time.sleep(.1) 
			BrickPi.MotorSpeed[arm] = 0
			BrickPiUpdateValues()
			time.sleep(.01) 
			break
		time.sleep(.01)              # sleep for 100 ms

What is wrong?

It looks like both values BrickPi.Encoder[arm] and init_pos haven’t been initialized. That’s what the exception is telling.

Let me check the code.

Thank you!

Edit: can you actually show me where you got that code?

Thank you for your reply. I am a 9th grade newbie at Raspberry Pi and Python. I am not sure how to initiallize the values :slight_smile:

I also have another problem with the BrickPi3. The led is not blinking at all! Is it broken?

1 Like

That project was written for the BrickPi+ and not the BrickPi3.
It can be adapted but it won’t be a 2 seconds fix.

Cleo

You can find the code in the file arm_test.py. If you search for bookreader 2 on Dexter Industries you will get a link that shows you how to make it. At the bottom of the link, there is another link to the Github page. The arm_test.py file is on the Github.

1 Like

where do I start? Any hint would be appreciated.

I found it here:

So, unfortunately, this project is only for the old BrickPi board. What you have is a BrickPi3. And for the BrickPi3 we have 3 projects that are listed in here.

You might want to do the BricKuber as it is in the same ballpark as the BookReader project for the old BrickPi board.

Thank you!

1 Like