the FileReader program

FileReader is a very simple program that displays the contents of a file on the NXT’s screen, one value at a time. This program uses two properties of the File Access block:

  • All values written to the file are text values. When you write a number, the File Access block converts it to a text value before writing it to the file. The block also converts a value from text to a number when reading the file, which means that you can read all the data from a file as text values, even if some or all of the data was originally numbers.

  • When reading from a file, the Error value will be true when all the data has been read. To read all the values in a file, you can read the values in a loop that continues until the Error value is true. ...

Get The Art of LEGO MINDSTORMS NXT-G Programming now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.