RGBmatrixPanel Library interfering with IRremote Library

  arduino, atmega, c++, infrared

I think I have found an error in the RGBmatrixPanel library AKA PxMatrix LED MATRIX Library.

I am using an Arduino Mega connected to a 64×32 .matrix board running PxMatrix version 1.8.1

The library RGBmatrixPanel, or more specifically the function matrix.begin(), which is used to initialise and start the board interferes somehow with the widely used IRremote library.

I have created a Minimal Reproducible Example (below) where this problem can be seen. The infrared receiver works normally as expected but as soon as matrix.begin() is run the infrared receiver stops returning values and instead returns random HEX codes.

Note: the IR receiver is plugged in to pin 3 on the mega
Note 2: the code does not actually print anything to the LED board, so it is clear it is a problem with the RGBmatrixPanel Library.

#include <RGBmatrixPanel.h>
#include <IRremote.h>

#define CLK 11
#define OE 9
#define LAT 10
#define A A0
#define B A1
#define C A2
#define D A3

RGBmatrixPanel matrix(A, B, C, D, CLK, LAT, OE, false, 64);

int RECV_PIN = 3;
IRrecv receiver(RECV_PIN);
decode_results results;

void setup() {
  Serial.begin(9600);
  //matrix.begin();      //unslash matrix.begin() for the IRreciver to stop working
 receiver.enableIRIn();
}

void loop() {
  if(receiver.decode(&results)) {            
    Serial.println(results.value, HEX);     
    receiver.resume();                      
  } 
}

I would appreciate any help you can provide on this matter, if you need any more info about this problem please let me know.

Thanks in advance, Elliot

Source: Windows Questions C++

LEAVE A COMMENT