Programming Robotics 101

What is robotics?

Robotics is the art of combining engineering & computer science; but also other disciplines in order to design, construct and use machines to complete tasks.
Robotics can be as simple as putting a motor on something like a toothbrush, to a dog.

How does robotics work?

Robots == computers, but why:

Input quantified by sensory detectors -> input is processed by designed logic -> output functions

The reading of sensors is done through software designed for processing data.

Depending on the software and sensory input type, different approaches may need to be taken for the processing of sensor readings.

A big challenge in robotics is a robot is only as good as its sensors.

What do you need for robotics?

To start with robotics Raspberry Pi’s, Arduino boards and Lego Mindstorm are really useful tools but when you start creating more complicated programs you can use items like:

  1. A microcontroller
  2. Raspberry Pi — A single-board computer
  3. A Robot Operating System (ROS)
  4. Matlab — Used for data analytics, used in conjunction with ROS

What language should you learn?

The programming language depends on what the robot needs to accomplish.

The most popular languages for robotics is:

  1. C/ C++
  2. Python
  3. Java
  4. Fortran
  5. Industrial Robot Languages

C/ C++

C and C++ are some of the popular choices for robotics; due to the ability to produce real-time results. It is more difficult than some other languages. C++ is the more popular choice due to having more functionality.

<Sample code for C++ — driving a robot using a joystick>


Python is also a popular choice. The reason being its capabilities with artificial intelligence.

<A sample python code for making a machine go forward and backwards>

For details on other languages for robotics.

How to start programming:

  1. Decide the logic of the program utilizing pseudo-code
  2. Let’s move with Arduino (-or use a simulator)
    Download the Arduino IDE
  3. Open up the IDE then configure board & port
  4. Let’s make a simple led light blink:
  5. Complex programs can use different loops
  6. Click the upload button

The Arduino language may seem simple but the format is similar to most programs.

The Arduino IDE even creates the setup and loop function for you when you start a new file.

For more Arduino functions you can check out the Arduino’s library for more functions.



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store