Controlling an NXT Robot with python (on MacOSX)
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
brew doctor
brew install libusb
To test if it works:
import usb.core
usb.core.find()
<DEVICE ID 0694:0002 on Bus 020 Address 005>
To test if it works, connect a brick and attach a motor to port A:
import nxt.locator
import nxt.motor
b = nxt.locator.find_one_brick()
m = nxt.motor.Motor(b, nxt.motor.PORT_A)
m.turn(50,360)
The motor should rotate 360 degrees