void loop()
{
if (IrReceiver.decode()) //this line checks if we received a signal from the IR receiver
{
Serial.println(IrReceiver.decodedIRData.command, HEX); //Print the value captured in HEX
Serial.println(IrReceiver.decodedIRData.command); //Print the results in decimal
IrReceiver.resume(); //receive the next value
}
}
Have tried with several TV remotes and working fine
But cant make own IR transmitter to work
Uno rev 3, transistor BC547 B331, emitter 1497-1062-ND (DigiKey)
Code #include <IRremote.h>
const int switchPin = 3;
IRsend irsend;
void setup() {
Serial.begin(9600);
pinMode(switchPin, OUTPUT);
}
void loop() {
2BKAC8
for (int i = 0; i < 3; i++) {
irsend.sendNEC(0x18, 32);
delay(40);
Serial.println (0x18, 32);
}
delay(10000);
}
Serial. println gives 0 and if instead 0x18 send 0x4BA2988; gives 2BKAC8.
My receiver don't get any info from my transmitter. Have tried all Christmas Days but can't find mistake. Any suggestions please!
Use the IDE autoformat tool (ctrl-t or Tools, Auto format) before posting code in code tags.
Please go back and fix your original post.
The transmitter code will not compile.
What version of the IRremote library are you using?
Please post a schematic. Written descriptions are always more ambiguous than a drawing. Hand drawn, photographed and posted is fine. Include all pin names/numbers, components, their part numbers and/or values and power supplies.
It is always a good start to first have a look at the examples provided by this library. Start with the Simple* and the *Demo examples.
Examples for this library are available in the Arduino IDE under File > Examples > Examples from Custom Libraries > IRremote > ...
Examples are also available at Github: Arduino-IRremote/examples at master · Arduino-IRremote/Arduino-IRremote · GitHub
Hi- I am back.
Device 1. IR remote device (from shop) - press on button- gives values as on the table.
Device 2. IR remote made by me Amazon.uk.co IR transmitter KY-005
Device 3. IR remote made by me Digikey IR emitter 1497-1062-ND
Device 4. IR remote made by me Digikey IR emitter 365-1042-ND
Enquiry behind every result in given in sketch IRRedA1 loop part.
0 0 0 0 Protocol=UNKNOWN Hash=0x0 1 bits (incl. gap and start)
received
In every remote made by me is the code the same and 2 own breadboard and 3-4 same own breadboard.
In SimpleSender_Forum there is the second TAB PinDefinitionsAndMore and don't work without this tab. Firstly don't undestand it and secondly why it is given in #include?
Secondly could someone help to tell how I get Device 3-4 to work.
Down pictures and code. In 2nd picture the red wire to 5V, blue gnd.
/* SimpleSender.cpp
Modifications made
* This file is part of Arduino-IRremote https://github.com/Arduino-IRremote/Arduino-IRremote.
*/
#include <Arduino.h>
const int switchPin = 3;
#include "PinDefinitionsAndMore.h" // Define macros for input and output pin etc.
#include <IRremote.h>
void setup() {
pinMode(switchPin, OUTPUT);
Serial.begin(9600);
// Just to know which program is running on my Arduino
Serial.println(F("START " __FILE__ " from " __DATE__ "\r\nUsing IRremote library version " VERSION_IRREMOTE));
IrSender.begin(); // Start with IR_SEND_PIN as send pin and if NO_LED_FEEDBACK_CODE is NOT defined, enable feedback LED at default feedback LED pin
Serial.print(F("Ready to send IR signals at pin "));
Serial.println(IR_SEND_PIN);
}
uint32_t aRawData = 0xE619FE01;
void loop() {
IrSender.sendNECRaw(aRawData);
delay(10000);
}
PinDefinitionsAndMore.h I did not copy here as it is better to look in Irremote library SimpleSend example
Now all IR remotes sends the same message, which is
E619FE01
19 (Hex)
25 (Dec)
8 (Protocol)
Protocol=NEC Address=0x1 Command=0x19 Raw-Data=0xE619FE01 32 bits LSB first
In devices 3 and 4 transistor was left out and connection as in 2 (= first picture). Transistor 220 ohms. First did not work, uno was blinking, reason 9V battery was only 6 V. After replacing it with new battery everything was ok.
NOW SOME SERIOUS WORDS:
When solving this problem spent hours in internet, also Arduino Forum. Unfortunately with poor results. Most discussions were Tik-Tok level. This message made by me is the first in Forum where you get the answer to this problem. Pls inform if I have overseen something.
Still question:
hoping someone could help. The sender part is a modification from IrRemote SimpleSender. There is secoond tab PinDefinitionsAndMore and don't work without this tab.
Here it was not coopied as can been found in library. Firstly don't undestand it and secondly why it is given in #include, but is not a library.