|
|
(19 intermediate revisions by 2 users not shown) |
Line 1: |
Line 1: |
| == Welcome to Logo for NXT == | | == Welcome to Logo for NXT == |
| | | |
− | This page contains information about the project of programming NXT in Logo language.
| + | {|- |
| + | | [[Image:nxtlogo.gif]] |
| + | | NXT Logo is a programming language for [http://mindstorms.lego.com/ LEGO Mindstorms NXT] robots. It is a children-oriented educational text-based programming language with the possibility of graphical output on the screen of the PC when used in combination with existing Logo programming languages, for example Imagine Logo. In that way, it outperforms the standard icon-based language NXT-G provided in the Mindstorms sets bringing NXT robots to the world of higher level educational projects and experiences. NXT Logo is currently in beta stages, but it can already be experiementally used as most features are available. |
| | | |
− | The project is under intensive development, and there are no releases yet.
| + | [http://webcvs.robotika.sk/cgi-bin/cvsweb/robotika/src/imagine/nxt/logo/releases/ Download here...] |
− | However, the projet is open-source and the latest development version is available in the [http://webcvs.robotika.sk/cgi-bin/cvsweb/robotika/src/imagine/nxt/logo/current/ CVS].
| + | |} |
| | | |
− | [[Image:nxtlogo.gif]] | + | * [[NXT Logo Overview|Overview]] |
| + | * [http://webcvs.robotika.sk/cgi-bin/cvsweb/~checkout~/robotika/src/imagine/nxt/logo/doc/reference_guide.html?content-type=text%2Fhtml Reference Guide] |
| + | * [http://webcvs.robotika.sk/cgi-bin/cvsweb/~checkout~/robotika/src/imagine/nxt/logo/doc/user_guide.html?content-type=text%2Fhtml User Guide] |
| + | * [[NXT Logo Tutorial and Examples]] |
| + | * [[Imagine Logo|About Imagine Logo]] |
| + | * [[NXT Logo Acknowledgments|Acknowledgments]] |
| | | |
− | == Features ==
| + | <googleanalytics>UA-375032-4</googleanalytics> |
− | | |
− | * Implemented in Imagine and [[NBC|Next Byte Codes]] (NBC)
| |
− | * Three levels of use:
| |
− | # Interactive Imagine project with direct GUI controls that allow interfacing with NXT robot over Bluetooth
| |
− | # Loadable imagine library (nxt.imt) that contains set of procedures for direct control of NXT robot over Bluetooth from your Imagine projects
| |
− | # Interpreter of Logo running on the NXT that can run logo programs (with restricted syntax), which can communicate with Imagine projects and control the robots motors and sensors.
| |
− | | |
− | == Motor & Sensor procedures ==
| |
− | | |
− | (motor m cmd [arg])
| |
− |
| |
− | where cmd is one of:
| |
− | on
| |
− | off
| |
− | brake
| |
− | regulate [speed]
| |
− | sync [ratio]
| |
− | on_rot [number_of_rotations]
| |
− | on_ms [number_of_ms]
| |
− | power [power]
| |
− | rst
| |
− |
| |
− | (readmotor m cmd)
| |
− |
| |
− | where cmd is one of:
| |
− | rotations
| |
− | tacho
| |
− | blocktacho
| |
− |
| |
− | (sensor N)
| |
− |
| |
− | (setsensor N type)
| |
− |
| |
− | where type is one of:
| |
− | raw
| |
− | switch
| |
− | tmp_C
| |
− | tmp_F
| |
− | refl
| |
− | angle
| |
− | light_a
| |
− | light_i
| |
− | db
| |
− | dba
| |
− | lowspeed
| |
− | ls9V
| |
− | | |
− | == Supported primitives ==
| |
− | | |
− | NXT Logo supports the following primitive procedures and operations:
| |
− | | |
− | # Arithmetic: ''<tt>add, sub, mul, div, mod, neg</tt>''
| |
− | # Logic: ''<tt>and, or, xor, not</tt>''
| |
− | # Bitwise: ''<tt>bitand, bitor, bitxor, bitnot</tt>''
| |
− | # Lists and words: ''<tt>first, bf, last, bl, item, se, list, word</tt>''
| |
− | # Maps & co.: ''<tt>map, apply, foreach, run, remote</tt>''
| |
− | # Loops and conditions: ''<tt>repeat, while, foreach, if, ifelse</tt>''
| |
− | # Predicates: ''<tt>empty? number? list? word? equal? gt? lt? ge? le? member?</tt>''
| |
− | # Variables and procedures: ''<tt>make, let, to, op, stop, erase, launch</tt>''
| |
− | # NXT file handling: ''<tt>load, printto, fopen, fwrite, fread, fclose, fremove</tt>''
| |
− | # Sounds: ''<tt>tone, sound</tt>''
| |
− | # Motors, sensors: ''<tt>motor, readmotor, sensor, setsensor, battery</tt>''
| |
− | # Other: ''<tt>wait, random, print, draw, ascii, char, boot, gc, fm</tt>''
| |
− | | |
− | The expressions must be in prefix notation. Variables are used the same way as in Logo - as "name when referring to variable name, and as :name when referring to its value. There are global variables as well as local variables, lexical scoping as usual in Logo.
| |
− | | |
− | The <tt>(remote expression)</tt> operations allow to start evaluating an expression on NXT when started from PC, and vice-versa. This can be used for communication. Of course, one could then easily say, for example:
| |
− | | |
− | remote [print "hello]
| |
− | | |
− | or
| |
− | | |
− | remote [my_program 123]
| |
− | | |
− | or read value of remote variable:
| |
− | | |
− | remote :varA
| |
− | | |
− | However, one has to keep in mind that BlueTooth communication is slow due to switching of the direction of the transceiver and receiver. Therefore, it is preferable to implement higher-level functions and procedures that can run on NXT brick autonomously. Logo programs have about 30kb of memory available - for storing both the logo programs and data, however, programs can load/erase data and code from NXT files that are stored in the large flash.
| |
− | | |
− | == Examples ==
| |
− | | |
− | Some sample code for Logo for NXT is in the [http://webcvs.robotika.sk/cgi-bin/cvsweb/robotika/src/imagine/nxt/logo/current/examples Examples folder].
| |
− | | |
− | == Syntax ==
| |
− | | |
− | Detailed syntax is shown in the file [http://webcvs.robotika.sk/cgi-bin/cvsweb/~checkout~/robotika/src/imagine/nxt/logo/current/syntax.txt?content-type=text%2Fplain syntax.txt].
| |
− | | |
− | == Reference Guide ==
| |
− | | |
− | More detailed description of all commands and the system are located here:
| |
− | [http://webcvs.robotika.sk/cgi-bin/cvsweb/~checkout~/robotika/src/imagine/nxt/logo/current/reference_guide.html Logo for NXT Reference Guide].
| |
− | | |
− | == Internals ==
| |
− | | |
− | Short specification of the Logo for NXT internals is in the file
| |
− | [http://webcvs.robotika.sk/cgi-bin/cvsweb/~checkout~/robotika/src/imagine/nxt/logo/current/specification.txt?content-type=text%2Fplain specification.txt].
| |
| | | |
| __notoc__ | | __notoc__ |