Installing NXT Python

Before creating the NXT RTC, PyBluez (a module for using Bluetooh from Python) and NXT Python (a module for controlling a NXT) must be installed.

Installing PyBlues

Download the Windows installer from the above link and run it.

Installing NXT Python

Download the zip file from the above link. NXT Python uses a setup.py script to install. If you have associated .py files with the Python interpreter, execute the script as follows from a command prompt:

 setup.py install
Otherwise, execute it similar to the line below:
 c:\Python24\python setup.py install

 Microsoft Windows XP [Version 5.1.2600]
 (C) Copyright 1985-2001 Microsoft Corp.
 
 C:\tmp\nxt_python-0.7>setup.py install
 running install
 running build
 running build_py
 ...
 copying build\scripts-2.4\nxt_filer -> c:\python24\Scripts
 copying build\scripts-2.4\nxt_push -> c:\python24\Scripts
 copying build\scripts-2.4\nxt_test -> c:\python24\Scripts
 
 C:\tmp\nxt_python-0.7>

Test NXT Python

Turn on the NXT and connect it to the PC. Using the samples under example/, confirm that the NXT can be controlled from the PC.

The example/ directory contains the following samples:

  • latency.py: Measures the latency in reading the sensors.
  • mary.py: Plays "Mary Had a Little Lamb."
  • message_test.py: Displays a message on the NXT's screen.
  • spin.py: Spins motors connected to ports B and C.
  • test_sensors.py: Displays all sensor values.

Motors and sensors must be connected appropriately for each test.