IR receiver cant decode continuous signal from transmitter

hi using IR transmitter and receiver im press the button on transmitter like remote and get the decoded data in serial monitor the problem is when i press the button for to long i get data right in first and the other data is 0 i so i cant get continuous signal ..
is there a solotion to press button for to long and get the data right ?

How do you know the transmitter is NOT just sending a code to tell the receiver to repeat the first code that was send?
Paul

1 Like

hi my friend
im not sure about what u say
its not the pair tran and rec, im using my tv remote for transmiting and every button has its own data and if i press every button in 500 ms it show the address again but when i press it for more than that i get 0

I expect you'd like to tell us what IR receiver you are using with what TV remote and also post the code you're using to see this "address again" or 0. We're not good at mind reading.

Steve

1 Like

Post your test code. Read the forum guidelines to see how to properly post code.
Use the IDE autoformat tool (ctrl-t or Tools, Auto format) before posting code in code tags.

This simple example code will repeat the keycode as long as the button on the remote is held (at least with my remote).

#include <IRremote.h>

const byte IR_RECEIVE_PIN = 4;

void setup()
{
   Serial.begin(115200);
   Serial.println("IR receive test");
   IrReceiver.begin(IR_RECEIVE_PIN, ENABLE_LED_FEEDBACK);
}

void loop()
{
   if (IrReceiver.decode())
   {
      unsigned long keycode = IrReceiver.decodedIRData.command;
      Serial.println(keycode, HEX);
      if ((IrReceiver.decodedIRData.flags & IRDATA_FLAGS_IS_REPEAT))
      {
         IrReceiver.resume();
         return;
      }
      IrReceiver.resume();
   }
}

Blockquote

// in this project we want to find a remote button address 

#include <IRremote.h>

int irpin =2;  // signal pin that connected to  ir reciver module

void setup()
{
  Serial.begin(9600);
  //pinMode(4,OUTPUT);
  IrReceiver.begin(irpin); //ENABLE_LED_FEEDBACK
} 

void loop()
{
  if ( IrReceiver.decode() )           // return true if code was recived and false if nothing was recived
  {
     Serial.print("data is ");
     Serial.println(IrReceiver.decodedIRData.decodedRawData); //decode datarecive
//     digitalWrite(4,HIGH);
//     delay(1000);
//     digitalWrite(4,LOW);
     delay(100);
     IrReceiver.resume();        //After receiving, this must be called to reset the receiver and prepare it to receive another code.
  }
}

// this is the code forgive me for comments

Blockquote

data is 3977428800
data is 3977428800
data is 3977428800
data is 0
data is 0
data is 0

the first time and the second time i press the power button and for 3rd time i press and hold and as u can see it just receive the address and after that it says data is 0

my freind what is decodedirdata.command ? and what does it do ?
in my example i use IrReceiver.decodedIRData.decodedRawData

When the data is not 0, save it, when it is 0, the code is the saved value, This is normal operation for some remote control protocols.

1 Like

From the IRremoteInt.h file.
/**

  • Data structure for the user application, available as decodedIRData.

  • Filled by decoders and read by print functions or user application.
    */
    struct IRData {
    decode_type_t protocol; ///< UNKNOWN, NEC, SONY, RC5, ...

    uint16_t address; ///< Decoded address

    uint16_t command; ///< Decoded command

    uint16_t extra; ///< Used by MagiQuest and for Kaseikyo unknown vendor ID. Ticks used for decoding Distance protocol.

    uint8_t numberOfBits; ///< Number of bits received for data (address + command + parity) - to determine protocol length if different length are possible.

    uint8_t flags; ///< See IRDATA_FLAGS_* definitions above

    uint32_t decodedRawData; ///< Up to 32 bit decoded raw data, used for sendRaw functions.

    irparams_struct *rawDataPtr; ///< Pointer of the raw timing data to be decoded. Mainly the data buffer filled by receiving ISR.
    };

decodedIRData is a struct with several members. addr, command, flags and decodedRawData of most interest.

Protocol IR receive protocol (NEC, RCA, ... ).
addr is short for address, I guess, but I call it device. To tell 1 remote from another.
command is the code for a particular key.
flags are flags for repeat, auto repeat, etc. See IRremoteInt.h line 158 in the source code.
decodedRawData is just what it says.

1 Like