Loginskip to content

NXT Repository/Programming/

Here you will find contributed NXT programs, NXT-G MyBlocks, NXT-G extension blocks, NBC codes, RobotC codes etc.

Search under this category:

Sub-categories:

  • Math related (4)
  • Alt.NXT-G (20)
  • NXT-G (41)
  • Contributions:

    Comparison of Programming Environments for NXT

    Last update: Tuesday, November 13th, 2007

    The winter issue of Robot magazine contains a comparison of the various programming solutions for the NXT. It’s available online at http://www.botmag.com/articles/10-31-07_NXT.shtml. The comparison includes implementation of a simple line following program using the different programming languages including screenshots from the different environments. [Note: I wrote the article and also helped author ROBOTC].

    Another NXT programming language discussion was justed posted on the Wired magazine web site at http://blog.wired.com/geekdad/2007/11/the-best-progra.html. Chris Anderson of Wired has been using his NXT to control his UAV — Unmanned Aerial Vehicle — and has tried many of the programming environments. For more on his airplane, see the videos at http://diydrones.com/video/video/show?id=705844:Video:43 

    Getting Started with NXT Byte Code (NBC) Programming

    Last update: Thursday, August 3rd, 2006

    Filip Verhaeghe posted this nice tutorial on how to work with NBC. Good point to start if you know nothing on NBC….

    GPS with RobotC

    Last update: Sunday, September 16th, 2007


    Dick Swan, the developer of RobotC, sent me a sample code for using a BT GPS with NXT using RobotC. The code can be downloaded here. As one can see in the image, it displays time, position and other data on the NXT LCD display. This code requires a RobotC version which is still not public, which can be rechived directly from Dick Swan (dickswan at sbcglobal dot net).
    How easy is it doing GPS communcation with RobotC? Well - very easy. You first turn the BT to ‘Raw Mode’ by setBluetoothRawDataMode() command. Then you simply read data (say one char) from the BT like a regular serial port with nxtReadRawBluetooth(BytesRead[0], 1). The rest of the code is GPS specific message parsing etc.
    I was also astonished how easy is it to connect BT device programatically in RobotC. The three lines at the end of the code:

    setSessionPIN(”1234″);
    bBTSkipPswdPrompt = true;
    btConnect(2, kGPSName);

    Is all you need! It defines the PIN code to use, tell the NXT not to show password dialog and connect to a preset device (given by a const string kGPSName).


    Any additions/suggestions/comments? Send an email to repository@nxtasy.org.