This is one of my first Arduino projects.
A simple idea when the controller emulates a remote to control a beamer using the IRremote library.
The circuit consists of an Arduino micro, an IR LED and a 330 ohm resistor.
The problem is that the irsend.sendNEC command does not affect the IR LED at all.
The LED works fine if you just turn it on with the digitalWrite command. The code it is supposed to send I have got by decoding my remote using the same tutorial I used for creating a sketch for sending the code (link Using IR Remote Controls with Arduino | DroneBot Workshop). The sketch for decoding recognizes the remote code as a code from the NEC protocol. But even if there is something wrong with the code, the LED should in any case show some activity, but this does not happen.
Here is the sketch, which simply sends a signal to a projector or a TV every 10 seconds (I tried different remotes and different codes). I tried to make it as simple as possible :
[code] #include <IRremote.h>
IRsend irsend;
void setup()
{ }
void loop() {
irsend.sendNEC(0xAF5E827, 32);
delay(10000);
}
[/code]
Pin 3 in the library is set as output automatically so the setup part is basically empty.
I've also tried different versions of the IRremote library (version 2.8.0 was used here) and read a lot of material, also on this forum but I still can't find a solution.
Maybe someone could help?
Thanks!!!
Are you using a cell phone camera to verify that the IR LED is working?
That tells me that you are using example code for an old version (<3.0) of the IRremote library. What version of the IRremote library do you have installed? Older code may not work with the new library versions. If you have the newer version (3.0 or greater) installed use the examples from that library. If you look, with the library manager, you will see that you can install older versions if need be.
Thanks for your answer! The Pin 3 is said to be a default one, but I also tried to put irrecv.enableIRIn(); and just set pin 3 as an output, but it did not seem to have any effect.
That’s a good hint!
But I tried to turn it on simply with digitalWrite function and I could see on my cellphone that it was quite bright. Do you think it still may need more juice to run?
Exactly, I am checking it with my cell phone camera.
And I installed an older version of the library- 2.8.0 specifically to match old tutorials.
Newer version also has a different function to send a signal, which needs an address and a command to be put separately and I failed to figure out what to put there, tbh. Because then I just put a constant part of the IR code as an address and a changing part as a command it didn’t work as well.
No it doesn’t… I tested it by just using a digitalWrite function and on my cellphone it was pretty bright and there was just nothing at all with the irsend.sendNEC function
If you are interested, here is a simple code to read a remote and return the code and the address for the button pressed and the protocol (type) of the remote that you are using.