Sending custom IR codes?

I have a project involving an IR LED on an ESP, and an IR receiver on a Micro.

I can send commands to the ESP from my phone, which responds by broadcasting IR signals.

The IR receiver picks these up, and does something with them in turn.

Thus, I am using IR signals merely as a means of communicating, not as a means of controlling any particular TV or other appliance, and so don't care about what codes I am sending.

However, I need to send lots of codes, and don't much like the idea of having to scrape these up piecemeal from various remote plans I find online.

Is there a simple, general coding scheme I could use, say under NEC protocol or RC5 protocol, for generating, say, 40–50 IR codes? Surely, not just any hex string. For example, I doubt


would work, for specifics to do with how IR codes are encoded under NEC, what an IR LED can actually broadcast, etc.

But what can I send on an IR lamp, and decode on an IR receiver? What are the permissible values that I could to code data?


For example, I doubt


would work

Why do you doubt that?

Skeptic: irsend.sendNEC(0x0001,16)

Is that a piece of code from a program on your phone, or from an Arduino program?

As you have said "IR receiver on a Micro" I presume it is part of a program on your phone. This is not really the place to get help with writing program for a phone.

This Serial IR link shows how you can use an IR link between two Arduinos to send serial data. Perhaps you can do the same thing between your phone and an Arduino.