What happens inside a microcontroller almost looks like magic. Think about it for a second: an Arduino Uno is executing 125,000 instructions per second. It is that fast! You may ask what an instruction is. Every line written in code is basically an instruction for the core processor of the microcontroller. So when we say
digitalRead(), that is an instruction.
Let's take an analogy to understand how a microcontroller works.
There are worms on the earth. Each worm is equivalent to an instruction or an operation that needs to be done.
There is a bird in the sky. Bird is going to take these worms to the chicks in the nest.
Chicks (or the core) eat the worms (or execute an operation/instruction). The mother bird has to keep bringing the worms to the chicks. The system is going to be fast when the chicks have already finished eating the worm before the mother bird brings in more worms.
This means that an operation needs to be executed before another operation...