Go Down

Topic: Error while reading values from two differant Infrared receivers? (Read 226 times) previous topic - next topic

emreakay

Hi i got a problem and i need help

i use Ken Shirriff's IRremote library

i want to read differant values from two differant ir receiver.
i can read one value but when connect second ir receiver and try to read 1 and 2 together, i cant see any result.

here is my code

/*
* IRremote: IRrecvDemo - demonstrates receiving IR codes with IRrecv
* An IR detector/demodulator must be connected to the input RECV_PIN.
* Version 0.1 July, 2009
* Copyright 2009 Ken Shirriff
* http://arcfn.com
*/

#include <IRremote.h>

int F = 2;
int B = 3;

IRrecv irrecvF(F);
IRrecv irrecvB(B); // bunu yaz?nca cal??smiyor

decode_results resultsF;
decode_results resultsB;

void setup()
{
 Serial.begin(9600);
 irrecvF.enableIRIn(); // Start the receiver
 irrecvB.enableIRIn();
}

void loop() {
 
 if (irrecvF.decode(&resultsF)) {  
   
   Serial.print("F: ");
   Serial.println(resultsF.value, DEC);  
   irrecvF.resume(); // Receive the next value  
 }
 
 
 
 if (irrecvB.decode(&resultsB)) {
   
   Serial.print("B: ");
   Serial.println(resultsB.value, DEC);  
     
   irrecvB.resume(); // Receive the next value
 }
}

michinyon

what actually happens when you run this ?

is the "resume()" function causing the whole thing to wait indefinitely ?

Go Up
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy