NXT_Python is a package for controlling a LEGO NXT robot using the Python programming language. It can communicate using either USB or Bluetooth. It is available under the Free Software Foundation's GPL license. It was developed on Fedora Core (Linux), but it has been reported to work on Windows XP and Mac OS X as well. Here's a sample program:
#!/usr/bin/env python import nxt.locator sock = nxt.locator.find_one_brick() if sock: brick = sock.connect() name, host, signal_strength, user_flash = brick.get_device_info() print 'NXT brick name: %s' % name print 'Host address: %s' % host print 'Bluetooth signal strength: %s' % signal_strength print 'Free user flash: %s' % user_flash sock.close()
groupadd lego
usermod -a -G lego [user-id]
BUS=="usb", SYSFS{idVendor}=="0694", GROUP="lego", MODE="0660"
NXT_Python was written by Douglas P Lau. See README file in the package for contact information.