Robot App Store

image description


LEGO NXT Create file command is ignored


I am trying to programmatically download a sound file to the NXT’s brick.

According to the tutorial, the way to download a sound file programmatically to the brick is:
  • Create an empty file on the brick using the FileOpenWriteCreate command;
  • Use the FileWrite command to fill the empty file with the sound file bytes;
  • Call to FileClose command to save changes and close;

I can’t make the FileOpenWriteCreate to work. It seems that NXT firmware ignores my command.

The file is not created although the reply message shows success.

The command that I send to the NXT is:
0x1A 0x00 0x01 0x81 0x74 0x65 0x73 0x74 0x2E 0x72 0x73 0x6F 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
0xB8 0x09 0x00 0x00

Am I missing something?


The command is correct.
The file will not be created until it is filled with data, and FileClose command is called;

In order to successfully create an RSO or any other file except a text file, the following operations should be performed:
  • Call the create file command (LinearFileOpenWriteCreate or FileOpenWriteCreate depends on your file’s type), with the correct arguments (described below);
  • Use the FileWrite command to fill the file with data. Rso files and all the supported files except the text files, are created only when their actual size is bigger than zero (not empty);
  • Call the FileClose command to save changes and actually create the file on the flash memory of NXT’s brick;

In generally, when the create file command is ignored, make sure that:
  • The command size is exactly 26 bytes 0x1A 0x00;
  • The correct open file command is used:
    0x8B TextFileOpenWriteCreate- for textual files (txt and log extensions).
    This is the only file type that can be edited and read;
    0x89 LinearFileOpenWriteCreate- for executable files and for icons (rxe, sys, rpg, rtm, ric file types);
    0x81 FileOpenWriteCreate- for the rest of the file types;
  • The name of the file contains 0x00 as a last character. The size of the name should be exactly 20 characters (including the 0x00 and the extension “.[file type]”). If the name of the file is less than 15 characters, just add 0x00 for every missing character.
  • File size is sent as LSB and there is enough space for this size;
  • Use the FileWrite to fill the file with data;
  • Use the FileClose to save changes;
read here cheats why men cheat on beautiful women
married men cheat women who cheat on men how to cheat husband
married and want to cheat my wife cheated now what my wife cheated on me with my father
will my wife cheat again link how do i know if my wife has cheated

Related Robopedia portals

Find out further reading in the following topic-based portals.
[Add or Edit Article]