When I buy a cheap remote from the store, and I run a IR receiving sketch, every time I push a button I get a series of numbers e.g. 1259575. Now I now how to receive IR.
But how do I transmit a number through IR? Every where I go it is outdated and doesn't work.
I just want to hook up an IR LED to arduino and have it flash a number
The IRremote ) library (look in Playground of Arduino web site) includes an IR transmit example that will show the code for transmitting IR codes using the library functions. For short range you can use an IR LED and current limit resistor (limit to 20mA) connected to an output pin. Check the example code for the pin that the example expects the LED to be connected to. Check the data sheet of the IR LED to make sure that it will work with less than 20mA cause some IR LEDs need more current to function.
You can find all the info about IR & Arduino on Ken Shirriffs blog at
He now has a GIT set up for latest release, which you can access via above site also.
Another great site is here
I have found that you can drive the IR LED directly from the Arduino as the current is limited. (But do so at your own risk).
If you are looking for distances of more than 2 or 3 feet then using a transistor to boost the stength is advisable.
AnalysIR-
NO! Haha I've been ALL OVER Ken Sheriff's website and I even email him but I can't find ANYWHERE on how to send numbers with IR. His tutorials are all on sending Sony and Panisonic codes and whatnot. I just want to send a simple sequence of numbers just like the cheap remotes do.
groundfungus-
I can't find IRremote library in the playground or examples. Please add a link.
Even the cheap remotes do not send simple bytes. They send a message. The NEC protocol is commonly used for the elcheapo's and work great with this library .
If you want something different you'll have to write your own protocol and hope it works :). Easier to stick to the defined protocols as it makes no difference from a programming perspective. Check the Github library to see how to send data and waht needs to be provided
agree with nicoverduin .... way too much work to design your own protocol and protocols such as NEC are designed to optimise the IR link and minimise interference.
just use the NEC codes for 0,1,2,3,4,5,6,7,8,9 and send them based ont the number you want to send to the other end, then when you decode these number at the other end you can translate them back to 0,1,2,3,4,5,6,7,8,9 to get your original number.
If you need additional help, you may have to be more specific about any problem. (e.g. details such as circuit, code, functionality etc)
Numbers 1, 2, 3, etc. (digits and commands) are represented by much longer numeric codes as you have found out from experimenting. Now, to transmit a number or command to an IR receiver means you need to reverse the process.
Here is a device that does that for one specific purpose, to turn-off the device. The code can be modified to send other sequence(s).