IRRemote - keeps crashing (14 red - Heap error) on Photon

Hi,

A few years back (~3ish) I was using IRRemote on a few Photons for IR decoding, and then to replicate the IR signal/send for AC units and TVs and such. The firmware was 1.5.0 at the time for the latest per logs.

I recently upgraded a Photon to 2.3.1 and noticed that it went into SOS mode + gave 14 red blinks (heap error).

I tried creating a new simpler firmware (essentially the base example) and that crashed too:

// Include Particle Device OS APIs
#include "Particle.h"

// This #include statement was automatically added by the Particle IDE.
#include <IRremote.h>


// Let Device OS manage the connection to the Particle Cloud
SYSTEM_MODE(AUTOMATIC);

// Show system, cloud connectivity, and application logs over USB
// View logs with CLI using 'particle serial monitor --follow'
SerialLogHandler logHandler(LOG_LEVEL_INFO);


int RECV_PIN = D0;

IRrecv irrecv(RECV_PIN);
    
decode_results results;


// setup() runs once, when the device is first turned on
void setup() {
  // Put initialization like pinMode and begin functions here
  Serial.begin(9600);
  irrecv.enableIRIn(); // Start the receiver
}

// loop() runs over and over again, as quickly as it can execute.
void loop() {
  // The core of your code will likely live here.
    if (irrecv.decode(&results)) {
        //Log.info("Value in HEX: %X", results.value);
        Log.info("Test!");
        irrecv.resume(); // Receive the next value
    }

  // Example: Publish event to cloud every 10 seconds. Uncomment the next 3 lines to try it!
  // Log.info("Sending Hello World to the cloud!");
  // Particle.publish("Hello world!");
  // delay( 10 * 1000 ); // milliseconds and blocking - see docs for more info!
}

I tried upgrading the firmware to 3x, and same.

I have not followed the releases, did something change in a substantial way that would cause this?

Any help/debug on this would be appreciated.

@ventz, I flashed your code using DeviceOS 3.3.1 on a Photon and had the same issue where the Photon connects and shortly after goes into SOS mode. However, when I changed the RECV_PIN to D3, the problem did not appear. The problem seems to appear when using pins D0 or D1. Specifying D2, D3 or D4 worked fine. Note that I do not have an IR sensor connected.

I am not sure if a breaking change occured at some point which creates a problem with using pin D0 or D1 in the IRRemote library.

3 Likes

@peekay123 Thank you so much!

Confirming that it worked with D3!

To be honest, it did not even occur to me to try to swap the data pin, mostly because it has been working for so long on D0 (Thanks for letting me know about D1 too)

If anyone knows what changed, I am curious just for the sake of knowing.

1 Like

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