ROBOTC Interface

< Tutorials
Revision as of 18:22, 15 May 2012 by Bfeher (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
Tutorials → ROBOTC Interface


ROBOTC for Mindstorms is an Integrated Development Environment. It has been developed to provide as much support as possible for the platforms it is compatible with. The ROBOTC interface will modify itself to accommodate the functionality found in your controller. ROBOTC extends the ‘C’ programming language with a number of built-in variables and functions to provide control over a robot’s hardware devices, i.e. the motors and sensors.


There are three main sections to the ROBOTC IDE:

  1. The Editor
  2. The Code Templates / Function Library
  3. The Main Menu / Toolbar


This is the part of the interface where the user can write code.

ROBOTC-IDE Editor.png

Code Templates / Function Library

This portion of the interface allows user to see all the functions available in ROBOTC at their user level. Portions of code from the "Function Library" can be dragged into the Editor.

ROBOTC-IDE Toolbar.png

Main Menu / Toolbar

This area allows you to perform basic tasks (saving, copy & pasting, undo, etc.), switch between multiple open programs using the tabbed interface, and access all of ROBOTC's additional functionality through the various menus.

ROBOTC-IDE Templates.png

Code Editor

Writing Code

Writing Code is the primary focus of ROBOTC, being a C-Based development environment. The ROBOTC Code Editor provides some visual assistance while programming with the use of line numbers and color coding:


Normal Text is displayed as black text. Normal text is used for variable and function names that are user-defined and not recognized by the compiler as reserved words.

Comments are displayed as green text . Comment are any bits of text in a program prefaced with a "//" or a "/*". This "commented text" is not considered code and is ignored when the compiler is generating byte-code to send to the robot controller.

Reserved Words/Pre-Defined Functions (int, motor) are displayed as bold blue text and italicized blue text.

Constants and Parameters (127, port1) are displayed as red text.

Syntax and Operands (+, -, *, {, <, [, etc.) are displayed as light red text.

Error Display

At compilation time, the ROBOTC compiler analyzes your code to identify syntax errors, capitalization and spelling mistakes, and code inefficiency, such as unused variables and redundant code. The ROBOTC compiler also has a powerful code optimizer that can shrink your program size by up to 50% before sending it to the robot to preserve memory space on your controller.

The Error display screen reports the number of errors in your code, as well as their types. Double-clicking a compiler message in the Error display screen will highlight the relevant line of code in your program. The "Previous", "Select", and "Next" buttons can also be used to cycle through and select the errors in your program.

Depending on the type of error, ROBOTC will only be able to highlight the approximate location of the error. For instance, in the example below the missing semicolon is on line 6, but ROBOTC will highlight line 7.


ROBOTC generates three types of compiler messages: Errors, Warnings and Information Statements.

ROBOTC has found an issue while compiling your program that prevented it from compiling. These are usually misspelled words, missing semicolons, and improper syntax. Errors are denoted with a Red X .

ROBOTC has found a minor issue with your program, but the compiler was able to fix or ignore it to get your code to compile. These are usually incorrect capitalizations of words or infinite loops without any code inside. Warnings are denoted with a Yellow X .

ROBOTC will generate information messages when it thinks you have declared functions or variables that are not used in your program. These messages have no affect on your program and only serve the purpose of informing you about inefficient programming. Information messages are denoted with a White X .


Breakpoints are a useful debugging tool in ROBOTC. Breakpoints can be placed on any line of code and tell the controller to stop executing the program when that line is reached. When a breakpoint is reached, the ROBOTC debugger informs the programmer, who can then check the status of the robot, code editor, and debugger windows at that point. ROBOTC supports multiple break points.

Breakpoints are denoted by a red circle in the gray area between the code and the line numbers.

To add a breakpoint:
Right-click on the line number where you wish to add a break point and a context menu will appear. Select "Insert Breakpoint" to place a breakpoint at that line.


To remove a breakpoint:
Right click on the red breakpoint circle and select "Remove Breakpoint".


Running your program with breakpoints:
When a breakpoint is in a program executing on the controller and the debugger is open, you will see the following message from ROBOTC:

Debugger breakpoint info.gif

This message is just an indication that the breakpoint has been reached. Click OK and then look at your program in the code editor. ROBOTC will highlight the line of the breakpoint that program stopped at, allowing you to see exactly which breakpoint the program executed.



Bookmarks are useful for navigating larger ROBOTC programs. You can use bookmarks to jump from one line of code to the next.

To Add/Remove a Bookmark: (Ctrl-F2)
Right click on the line number that you wish to add or remove a bookmark and a context menu will appear. Select "Toggle Bookmark" to place or remove a bookmark at that line. Pressing Ctrl-F2 on your keyboard will also add or remove a bookmark on the line with the cursor.


To Use Bookmarks: (F2) & (Shift + F2)
You can jump to the next line of code that has a bookmark by pressing the (F2) key on your keyboard, or by going to the "Edit" menu and selecting "Find Next Bookmark." You can also go to a previous bookmark by pressing (Shift + F2) , or going to the "Edit" menu and selecting "Find Prev Bookmark."

Bookmarks-next.png Bookmarks-prev.png

Clear all bookmarks: (Ctrl + Shift + F2)
You can clear all bookmarks by going to the "Edit" menu and clicking "Clear All Bookmarks". You can also use the keyboard shortcut (Ctrl + Shift + F2) to clear all bookmarks as well.


Bookmarks Toolbar:
If you have the Bookmarks toolbar enabled, you can use it to toggle, switch between, and clear bookmarks as well. To enable the Bookmarks toolbar, right-click on your toolbar and select "Bookmark".


Status Bar

The Status Bar gives you information about the ROBOTC editor and the current program.


  1. Context Help - Hover over different sections of the ROBOTC interface for brief descriptions.
  2. Download Target - Displays the current download target.
  3. Active Platform - Displays the currently selected platform type.
  4. Active Project - Displays the most recently compiled program.
  5. Read-only Status - Displays the file permissions for the most recently compiled program.
    • R/W - Read and Write Access
    • R/O - Read Only Access
  6. Compiler Errors - Displays the number of Warnings and Errors in a program, if any.
  7. Line/Column Display - Shows the line number and character of where the text cursor is currently located.