Cloning an infrared remote controller on Android
In a previous article , I reverse engineered my TV's infrared protocol as a backup measure in case the remote controller stops working. A couple of years later, it finally happened. Luckily I have infrared support in my phone, a 2022 Redmi 10. It comes preinstalled with an app that supports multiple infrared protocols including the NEC one. Unfortunately, none of the installed NEC versions were compatible with my TV since it uses a modified version of the protocol. I decided to take matters into my own hands. The infrared documentation for Android isn't lengthy, but it doesn't have to be. It boils down to sending a series of ON/OFF pulses with a given carrier frequency: public void transmit (int carrierFrequency, int[] pattern); To do that, I converted the functions of the previous project from C to Kotlin. The differences were minimal. In the android version, I had to construct an array of pulses whereas in the C version, I sent them immediately by switching PORTB