IrReceiver.decode() blocks all tasks from running if I have more than two tasks?
I am working on a project for school with where I should control a small robot using three tasks, one task measuring the distance from the robot to the closest object using an ultrasonic sensor, one task controlling the IR receiver that sends commands to the third task that executes commands. I am encountering a problem with the IR receiver task, mainly IrReceiver.decode(), that should check if a command from the controller has been issued. However, when I run all three tasks together, IrReceiver.decode() blocks all three tasks and not a single task is executed. It works fine if I am only using two tasks, one of the motorControl/distanceSensor tasks together with the IR task. I am using a HC-SR04 ultra sonic sensor and a TSOP3823 IR receiver, together with an Arduino UNO. Full sketch below.