Skip to Main Content
The Art of LEGO MINDSTORMS NXT-G Programming
book

The Art of LEGO MINDSTORMS NXT-G Programming

by Terry Griffin
August 2010
Intermediate to advanced content levelIntermediate to advanced
288 pages
13h 21m
English
No Starch Press
Content preview from The Art of LEGO MINDSTORMS NXT-G Programming

checking for errors

One interesting aspect of the File Access block is that it may not be able to perform the task you’ve given it. For example, the block can’t read from a file that doesn’t exist, and it can’t write to a file if the NXT’s memory is full. The block’s Error data plug (shown in Figure 15-9) allows you to check for these kinds of situations. The data plug reports a logic value, namely, true if there was an error and false if the operation was successful.

The File Access block’s Error data plug

Figure 15-9. The File Access block’s Error data plug

Any File Access block can have an error. When designing your program, you need to decide whether you should add code to check for ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

The Art of LEGO MINDSTORMS EV3 Programming (Full Color)

The Art of LEGO MINDSTORMS EV3 Programming (Full Color)

Terry Griffin

Publisher Resources

ISBN: 9781593272180Errata