RoboticsGeneral

MAQUEEN IR Codes

userHead anonymous 2019-08-11 15:29:56 3840 Views3 Replies
Hi,
I have noticed that the IR codes reported by the sensor do NOT match the NEC IR codes when read in the MIND+ IDE and in MAKECODE IDE.
Reference is only to the last 2 hex digits.
Also in MAKECode, the IR codes read are three digits, but the code executes correctly ONLY if one compares the last two digits.

Below are all three for your study:
Code: Select all
NEC CODES             MQ-IR CODES     MQ-IR CODES 
Key Encoded Value     in MIND+        in MAKECODE 
        hex    dec    hex  dec           dec      

0   0xFF4AB5 - 181    B5 - 181           182      
1   0xFF6897 - 151    97 - 151           122      
2   0xFF9867 - 103    67 - 103           125      
3   0xFFB04F -  79    4F -  79           113      
4   0xFF30CF - 207    CF - 207           112      
5   0xFF18E7 - 231    E7 - 231           124      
6   0xFF7A85 - 133    85 - 133           194      
7   0xFF10EF - 239    EF - 239            18      
8   0xFF38C7 - 199    C7 - 199           128      
9   0xFF5AA5 - 165    A5 - 165           190      

Please advise where the differences come from.
TG
2019-08-12 18:48:20 The issue is NOT whether the codes work fine or not !

1. Same remote controller used in MakeCode and MIND+ produce different IR codes.
Since the library is by DFROBOT, I am asking why there is a difference.

2. In MakeCode, an IR code for button "1" produces code 122. However, when this code is used in the program IF statement, one must code: "IF message = 22" instead of 122. Why ?

3. In MIND+, IR codes are 3 digits, and the IF statements also use 3 digits. Why the difference from MakeCode?

Below are two programs, one for each IDE. Try it before guaranteeing the codes work OK !

MAKECODE:
Code: Select all
/**
 * Even though the IR message received has the codes 122 and 190 for number 1 and 9 respectively, the IF comparisons have to be for 22 and 90 for it to work!
 * 
 * Checking for 122 and 190 does NOT work.
 */
maqueen.IR_callbackUser(function (message) {
    serial.writeLine("" + message)
    if (message == 22) {
        basic.showString("1")
    }
    if (message == 90) {
        basic.showString("9")
    }
})
serial.redirectToUSB()
serial.writeLine("Port ready")
MIND+:
Code: Select all
/**
 * IR message received has the codes 151 and 165 for number 1 and 9 respectively. The IF comparisons have to be for 151 and 165, NOT LIKE THE MakeCode!
 */
#include <DFRobot_IRremote_dal.h>

DFROBOT_IRremote_Receive remote(16);

void onIRReceive(uint8_t data_IR)
{
	Serial.println(data_IR);
	if ((data_IR == 151)) {
		Serial.println("1");
	}
	if ((data_IR == 165)) {
		Serial.println("9");
	}
}


void setup() {
	Serial.begin(9600);
	Serial.println("PORT Ready");
	remote.begin();
	remote.setCallback(onIRReceive);
}

void loop() {

}
userHeadPic anonymous