The "invalid Timer number" error occurs because the IRUnit is trying to use a hardware timer that's either unavailable or already in use on your M5 device. ESP32-based boards have limited hardware timers (usually 4, IDs 0-3), and the default timer allocation in the IR library might conflict with other system functions.
Solution:Explicitly specify a valid timer ID when initializing the IRUnit. Modify your setup code to include the timer_id parameter with a value between 0-3:
ir_0 = IRUnit((1, 2), timer_id=1) # Try timer IDs 0, 1, 2, or 3
Troubleshooting Tips:
Test different timer IDs (0-3) if the first attempt fails
Ensure no other libraries/features are using the same timer (e.g., PWM, other sensors)
Verify your M5 device's firmware is up-to-date via UIFlow2
https://chat.m5stack.com/