How to fix nxt.motor.BlockedException?

204 views Asked by At

I have the following script: 

#!/usr/bin/env python

import nxt.locator
from nxt.motor import *

def spin_around(b):
    m_left = Motor(b, PORT_B)
    m_left.turn(100, 360)
    m_right = Motor(b, PORT_C)
    m_right.turn(-100, 360)

print("Script Starting")
b = nxt.locator.find_one_brick()
spin_around(b)

I have installed pyUSB and libUSB. I run the script with python spin.py

However, when I run the script I get the following exception:

Script Starting
Traceback (most recent call last):
  File "spin.py", line 14, in <module>
    spin_around(b)
  File "spin.py", line 8, in spin_around
    m_left.turn(100, 360)
  File "/Library/Python/2.7/site-packages/nxt/motor.py", line 211, in turn
    raise BlockedException("Blocked!")
nxt.motor.BlockedException: Blocked!

Why is this exception occurring?

1

There are 1 answers

0
Foobar On BEST ANSWER

The script is making calls to motor ports "b" and "c".

If you do not have a motor plugged into port "b" or "c" then this exception will be caused.

To fix this error plug a motor into port "b" and another motor into port "c".