Skip to content

irremote not working properly on arduino boards #748

@sdeoras

Description

@sdeoras

irremote library (or the underlying tinygo machine drivers) don't seem to be functioning properly for arduino boards. I tried on arduino nano every and arduino nano 33 iot and the behavior on both is different and not functioning properly in either. As a reference I compared against code written in Arduino IDE using IRremote.h and that worked in both cases.

Here are details:
The Arduino IDE code that worked on both boards:

#include <IRremote.h>

#define IR_RECEIVE_PIN 9

void setup() {
  Serial.begin(9600);
  IrReceiver.begin(IR_RECEIVE_PIN);
}

void loop() {
  if (IrReceiver.decode()) {
    IrReceiver.resume();
    Serial.println(IrReceiver.decodedIRData.command);
  }
}

It prints consistent values on the serial based on the button pressed on the IR remote.

The tinygo driver does not exhibit similar behavior. Looking more into the code it seems the pulse intervals are not arriving as expected. In particular, on arduino nano 33 iot board, the pulse timing appears to fall through following state changes as expected but fails to move to bitReadEnd due to a much longer than expected pulse.

State changes before reset occurs on arduino nano 33 iot

leadPulseStart
leadSpaceStart
leadSpaceEnd
bitReadStart

I should also mention that looking into pulse width timing the behavior is not consistent across different boards and I get different values on arduino nano every v/s arduino nano 33 iot.

Reading up other issues it seems SetInterrupt() is not implemented on all pins, however, that does not seems to be the issue here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions