The idea here is to show that a delay, HAL_Delay(2000);
, it might affect you negatively.
You press the button and it is not until that delay has expired that the button change is detected.
Imagine having a steering wheel with paddles to change gears.
How frustrating would it be that you tried to shift gears and it did not happen until two seconds later?
Formula SAE steering wheel (developed by an Automotive Systems student)