C/C++ in Robotics – And why you should learn them

To program a robot there are many options of programming languages, but C/C++, have features that set a remarkable difference between them and the other programming languages. You might ask how important is a programming language in robotics in the first place?. Well… the answer is a lot. That’s due to the fact that you’re working based on variable information, digital and analog data. There’s no way you can execute a certain amount of task, using that kind of information without the use of programmable source code.

Souce code: “a text listing of commands to be compiled or assembled into an executable computer program.”


What’s a programming language

A programming language is a set of commands, instructions, and other syntax use to create a software program. Languages that programmers use to write code are called “high-level languages.” This code can be compiled into a “low-level language” (zeros and ones), which is recognized directly by the computer hardware.

Importance of C/C++

Ok, got it… but why C/C++ though?. The answers are the number of libraries available to work with and just from one click away. There is a lot of functions and documentation based on C/C++ programming language. You to just download the library, include it in your source code and it’s done. They now have access to a variety of functions that will help them program their task in no time.

Library: is a collection of precompiled routines that a program can use. The routines, sometimes called modules, are stored in object format. Libraries are particularly useful for storing frequently used routines because you do not need to explicitly link them to every program that uses them.

Also, C/C++ is pretty intuitive, it’s excellent for starters. I learned C as my first programming language and have been working with still to this day. It also has given a lot of leverage when trying to learn other programming languages.

The transition from C to C++ (an object-oriented programming language) it isn’t rough, you just need to understand how do classes work, things about heritage, structures, and so on.. The reality is that C/C++ is really a language that will remain usable and productive for a long time.

Object Oriented Programming: is a programming language model organized around objects rather than “actions” and data rather than logic.

The Arduino IDE (integrated development environment) it’s based on C/C++, and we will be working with it a lot in our projects.

Arduino IDE code C/C++
Sample source code on the Arduino IDE, you can see the similarity with C/C++.

So if you know a bit of C, or you want to start with a new programming language more useful in robotics C/C++ is an excellent way to go.
C/C++ has great scalability because farther on you can learn C# and abuse of all of his monstrous capabilities and features.

Benefits of C/C++.

C

  • General-purpose programming language and can efficiently work on enterprise applications, games, graphics, and applications requiring calculations.
  • Has a rich library which provides a number of built-in functions. It also offers dynamic memory allocation.

C++

  • Highly portable language and is often the language of choice for multi-device, multi-platform app development.
  • Is an object-oriented programming language and includes classes, inheritance, polymorphism, data abstraction, and encapsulation.
  • Allows exception handling, and function overloading which are not possible in C.
  • Powerful, efficient and fast language. It finds a wide range of applications, from GUI applications to 3D graphics for games to real-time mathematical simulations.

Build and Android APK without knowing any Java and in no time.

Click this link. In it, you’ll find out more about this excellent platform called “MIT App Inventor“.

Hope this was helpful. See you in the next post.

Thank you for reaching this far!

Let Us share great content with you.Don't miss out on the latest project updates, blogs and more...

2 replies on “C/C++ in Robotics – And why you should learn them

Leave a Reply