Pages: [1]   Go Down
Author Topic: Error while reading values from two differant Infrared receivers?  (Read 185 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 4
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
  }
}
Logged

Offline Offline
Faraday Member
**
Karma: 62
Posts: 3077
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

what actually happens when you run this ?

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

Pages: [1]   Go Up
Jump to: