Should I use C or python for robotics?

I’m trying to get into coding for robotics, but I don’t know which coding language to learn first. Google says C or Python so I was wondering what the pros and cons were for each of those. Please let me know.
Thank you!


Welcome to the forums @huntermatson25424817 :slight_smile:

C and Python are both good for robotics in their own ways.

  • Python

    Python is easy to learn and a good first programming language, it is also very flexible and can be used for a number of things, including robotics. It is excellent in the AI and data processing fields. However it does have its limits in robotics. It is not a pre-compiled language, meaning it has to be compiled each time before running. This can slow down a program, and makes debugging a good bit harder than other languages, which can catch an error when compiling instead of it showing up during the program running.

  • C / C++

    I would personally lean more towards C and C++ in the robotics field for several reasons. C and C++ are much lower level languages, which mean they interact more closely with the hardware. Though lower level languages are not as easy to read and write as higher level ones like Python, they give you much more control over the hardware, enabling you to use it more exactly. C and C++ are also pre-compiled languages, which mean that they are translated into machine code before being run. This saves time since it does not have to be compiled every time, and can catch more errors before you try to run the program.

There are robotics platforms built for both of these languages, so looking into which platform you want to use is a good idea. For example Rasberry Pi is written in Python, while Arduino uses C.


I prefer python, mostly because I’m better at using python then C.


Would it be possible to pre-compile the Python code so it is readily executable?

Not sure how the above would apply, but it does seem to remove some of the time lag of running straight Python. El Greenhorn, here, so bear with me if this is a dumb question.


Thank You so much!!!

1 Like

Yep! Arduino has its own language but it’s pretty much C/C++. Raspberry Pi uses Python. They are both great starting points.

If you are interested, check out this course on Codecademy:

It uses CircuitPython (pretty much Python) to code up a little Circuit Playground board :slight_smile: