Arduino multitasking and time management

Multitasking in Arduino

I am not an expert in Arduino, although I have not used the plate for a long time. And the times I have done it has been as a tool, copying and pasting code already created but without much interest to really learn how it works but simply with the intention of making it work and find it useful. This Christmas I tuned the Nativity scene a bit with some LEDs and an HC-SR04 ultrasonic sensor. And I stopped to observe what had to be done.

I just wanted to do different things with two LEDs from the same signal. Oops I quickly stumbled upon what I think will be one of the first limitations you encounter when you start to mess with Arduino. And it is not necessary to complicate it much. I speak only of some LEDs, you realize that you cannot do what you want correctly.

Let’s make it clear from the beginning in Arduino multitasking does not exist, you cannot process two tasks in parallel. But there are techniques to make calls so fast that they seem to work at the same time.

I tell you the case in more detail. At Christmas I rode a Nativity scene and I wanted certain birth lights to come on when my daughters approached. Nothing complicated I just wanted two branches of LED lights to work differently depending on the values of a proximity sensor.

Read moreArduino multitasking and time management