LEGO MINDSTORMS NXT Software enables users to program their robots by simply dragging and dropping the various blocks. This program can be downloaded to the NXT brick to run the robot. This kind of programming environment is known as; GUI based programming, and is most suitable for small and simple programs.
However when it comes to implementing a complex programming logic such as the parallel processing of instructions (GUI environment allows only 3 parallel process in a program), one needs ,pre flexible programming environment, may be – programming in C or Java.
Developed by Dennis Ritchie at AT&T labs, C is the most widely used programming language and served as core language behind development of object oriented and other widely used wrapper language and APIs like C# and Java. Since C a fundamental programming language, one should get comfortable with C, before moving to other programming language and develop expertise into programming.
There are many programming environments available in market to program LEGO MINDSTORMS Robot in C language, like - Bricx Command Centre (BricxCC), ROBOTC, etc.
BricxCC is a free and easily available integrated development environment (IDE), and in this tutorial we will leverage BricxCC as the programming environment to write the programs in C.
BricxCC can be downloaded for free from http://sourceforge.net/projects/bricxcc/files/bricxcc/
This is a sample tour, however full course broadly covers two subjetcs-
This course comes free with any paid subscription. Please contact us on firstname.lastname@example.org if you have any queries.
Tips: You may want to go for BricxCC…
- Model is complex and the size of the NXT-G program is large
- You have to execute multiple tasks simultaneously (i.e. more than 3 tasks at a time)
- Certain repetitive task in the program. For example: If the robot has to sort balls of different colors then it will have to perform the color check repetitively. If this program is made using NXT-G then the size of the program increases unnecessarily, while if it is written in BicxCC just a function call will be sufficient whenever required. Although NXT offers My Block, but C will certainly be more handy.
There are set of instructions that will be used in other programs. In this case if one is using NXT-G then user can achieve this by using the My Block but it has its own limitations. For example, if in My Block of a program 1 the motor is connected to port A and it is used in program2 where the motor is connected in port B, then the user will have to change the ports manually while using it in program2, whereas this can be achieved in BricxCC just by passing the output port parameters in function.