Dear Princess Celestia,
Recently, I have been been experimenting with an IR led with an my Arduino. Ken Shirriff made a library for recording and sending IR codes, but since I have yet to find an IR receiver, so I focused on sending signals. I decided to attempt to emulate an Apple Remote since I could quickly see if it works as I coded it. From a HiFiDUINO blog post, I found out that this remote is based on the "NEC" protocol and included the code sent by each button. Each bit of data is defined by a pulse and a space of certain lengths. Specifically for the Apple Remote, it sends 4 bytes of data. In hexadecimal, it sends 0xEE and 0x87 followed by the command code and the remote ID.
However, directly passing these codes to the included "sendNEC()" function did not work. I later realized that each of the four bytes of the data are sent least significant bit first; each byte is essentially sent backwards. Instead of 0xEE870206, I had to use 0x77E4060. This code was for the menu button on the Apple Remote, and testing it on an Apple TV, I was able to turn it on! Using my calculator in programmer mode, I found out all of the other codes by flipping each byte. To support different remote ID's, I added also conditional to use an alternate command code with the appropriate parity bit depending on the ID.
I have included my Arduino sketch and other information after the break.
Recently, I have been been experimenting with an IR led with an my Arduino. Ken Shirriff made a library for recording and sending IR codes, but since I have yet to find an IR receiver, so I focused on sending signals. I decided to attempt to emulate an Apple Remote since I could quickly see if it works as I coded it. From a HiFiDUINO blog post, I found out that this remote is based on the "NEC" protocol and included the code sent by each button. Each bit of data is defined by a pulse and a space of certain lengths. Specifically for the Apple Remote, it sends 4 bytes of data. In hexadecimal, it sends 0xEE and 0x87 followed by the command code and the remote ID.
However, directly passing these codes to the included "sendNEC()" function did not work. I later realized that each of the four bytes of the data are sent least significant bit first; each byte is essentially sent backwards. Instead of 0xEE870206, I had to use 0x77E4060. This code was for the menu button on the Apple Remote, and testing it on an Apple TV, I was able to turn it on! Using my calculator in programmer mode, I found out all of the other codes by flipping each byte. To support different remote ID's, I added also conditional to use an alternate command code with the appropriate parity bit depending on the ID.
I have included my Arduino sketch and other information after the break.