IR sensor how to get continuous ir signal?

Hello Im using last version of IRremote library. Im using my code. If I press the remote controller button 1 time it gives me data but if I hold my finger on a button it gives the value first then all zero. I tried everything but I couldnt find the solution. I want continuous data for drive my motor for example. Thanks... My code is below...


#include <IRremote.hpp>
#include <IRremote.h>

int RECV_PIN = 2;
IRrecv irrecv(RECV_PIN);
decode_results results;

unsigned char t;

void setup() {
  Serial.begin(9600);
  //irrecv.enableIRIn();
  irrecv.begin(RECV_PIN);
}

void loop() {

  if (irrecv.decode())
  {
    Serial.println(irrecv.decodedIRData.decodedRawData, HEX);
    irrecv.resume();
    delay(10);
  }

} 

If the transmitter isn’t sending anything, the receiver can’t receive it.

What you could try, is ‘saving’ the most recent state that was sent & received, until a different code is received.

Many remotes (NEC) send a repeat code 0xFFFFFFFF after first sending the initial button code.

As long as you keep seeing this repeat code, keep on trucking.

That is the problem I cant send same data. Im pressing same button but it gives me data first then sending always 0000000

What is the meaning by keep trucking dear Larry I dont get it.

Keep your electric motor running as long as you are receiving the repeat code.

I solved that problem but now Im suffering from discrete signal. When I press the button I get an signal but ig is coming so fast discrete. I mean fast as miliseconds so when I wanted to trigger my relay module, it cant be working(I think because of the discrete, it is not enaugh power for relay pin) Thank you Larry

Post you latest code. Your attempts to solve the repeat command from your remote control device is probably interfering with something.

thank you I solved the problem. The problem was: ir sending data average in 50ms continuously so if I put my code inside of if else loop and wants stay in if, it failed because, First it enters in if loop then arduino works faster than ir receiver so that my code repeat again and goes else 4 times more, so it was a discrete signal for me. Then I added 120-130ms delay in to my void loop function. So it is working now. Thank you all guys... If you want to discuss more about this error and understand why it happening you can also reach me via mail taylan.koll@gmail.com

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.