5.14. Conditional compilation

For many years now, people have been improving their tools, studying the forces of nature and bringing them under control, using the energy of the nature to operate their machines. Last century is noted for the creation of machines which can operate other machines. Nowadays the creation of devices that interact with the physical world is available to anyone.
Our course consists of a series of practical problems on making things that work independently: they make their own decisions, act, move, communicate with each other and people around, and control other devices. We will demonstrate how to assemble such devices and programme them using the Arduino platform as a basis.
After this course, you will be able to create devices that read the data about the external world with a variety of sensors, receive and forward this data to a PC, the Internet and mobile devices, and control indexing and the movement. The creation of such devices will involve design, the study of their components, the assemblage of circuit boards, coding and diagnostics. Along with the creation of the devices themselves, you will perform visualization on a PC, create a web page that will demonstrate one of your devices, and figure out how an FDM 3D-printer is configured and how it functions.
Besides those keen on robotics or looking to broaden their horizons and develop their skills, the course will also be useful to anyone facing the task of home and industrial automation, as well as to anyone engaged in industrial design, advertising and art.
The course does not require any special knowledge from the participants and is open even to students of upper secondary school. Programming skills and the level of English allowing to read technical documentation would be an advantage, but this is not obligatory.
The entire course is dedicated to practice, so the best way for you would be to get hold of some electronics, follow the illustrated examples and experiment on your own.
The kits can be purchased here: kits.cyberphysica.ru.
Taught by: Alexey Perepelkin, head of Robotics department in the Laboratory of innovative educational technologies at MIPT
Taught by: Dmitry Savitsky, researcher in the Laboratory of innovative educational technologies at MIPT

AC

Is an admired course. I can't wait to have my fingers wrapped around it. I am really excited to be on this program.

NC

Jul 16, 2017

Filled StarFilled StarFilled StarFilled StarFilled Star

enjoying failing many times and passing after studying and knowing much more during the tests.

从本节课中

Week 5.

Let’s turn one wheel and then two wheels at once, and the robot car will start moving. It’ll be moving along the line or under your control. It could as well be just messing with your hand with which you are trying to control it.

教学方

Алексей Перепелкин

Руководитель направления развития цифрового творчества

Дмитрий Савицкий

Научный сотрудник

脚本

You must have already come across the difficulty when you have to
simultaneously read the Port Monitor and check new parameters on the line while you are working on your line follower robot. This is quite a complex task, since you have to hold the robot in your hands so that it doesn’t escape, or switch off the sections of your code which are responsible for the output
on the Port Monitor, because there must surely be a delay included, which will slow down the
reading of the sensor values. In reality, there is a simpler way when you turn on all the code elements at the same time. There is a special structure called ifdef. It is needed so that before compiling, the environment could select the sections of
the code which are going to be compiled. In my situation, I have an element called COMM, which stores everything connected with the output of the values on the Port
Monitor. First, we need to establish a connection and then start the output. Try to output all the existent parameters, and do it simultaneously by organizing them in a table. For this purpose, you can use the tab character, which will allow you to keep your output values in order. Also, you need to monitor what input value combinations give you at the output. Well, that’s that. Apart from ifdef COMM, which is responsible for the output of the values in the Port Monitor, I have created another definition
called DRIVE. This is the element that makes the motors turn. How does it work? What’s the idea behind it? The compiler will pick the fragments, which are described by macrodefinitions. In other words, if there exists a macrodefinition for a fragment of
the code, then this fragment will be included in the compiled code. Thus, when I have the COMM macrodefinition in my program, all the fragments denoted with this macrodefinition are going to be
compiled. The same thing happens with DRIVE. If both macrodefinitions are defined simultaneously, then
the whole program will be
compiled. If we comment out either of these macrodefinitions, they will disappear from the code, and the fragments of the code that were
defined by these macrodefinitions
won’t be compiled. For this reason, you don’t need to go through the whole code
and look for fragments to be commented out or uncommented. You just need to define (or,
in the opposite case, not
define) The corresponding macrodefinitions.