I had to insert a little sleep in the sensor_thread-loop to avoid high CPU usage while motion detected (peripherals.get_infrared)