[Infrared4Arduino] Sensor and Declarations - Multidecoder.ino

Good day peoples, i am a starter, and i am getting two trouble to get my project on (automatic configure on samsung a.c.).

Using the example of library Infrared4Arduino (Multidecoder.ino) - example below, i dont undertand why in declaration RECEIVE_PIN, it use the letter "U" after of the pine number (static constexpr pin_t RECEIVE_PIN = 5U;)

I normaly use only the number of pine... this is right and why?
The second is about this info (// It requires a demodulating sensor connected to pin RECEIVE_PIN.), what is demodulating sensor? is the infrared sensor?

Thanks so much

// This sketch demonstrates the MultiDecoder.
// It requires a demodulating sensor connected to pin RECEIVE_PIN.

#include <IrReceiverSampler.h>
#include <MultiDecoder.h>

static constexpr pin_t RECEIVE_PIN = 5U;
static constexpr size_t BUFFERSIZE = 200U;
static constexpr uint32_t BAUD = 115200UL;

IrReceiver *receiver;

void setup() {
    Serial.begin(BAUD);
    receiver = IrReceiverSampler::newIrReceiverSampler(BUFFERSIZE, RECEIVE_PIN);
}

void loop() {
    receiver->receive();

    if (receiver->isEmpty())
        Serial.println(F("timeout"));
    else {
        MultiDecoder decoder(*receiver);
        if (decoder)
            decoder.printDecode(Serial);
        else
            Serial.println(F("No decode"));
    }
}

i'll guess that since 'L' indicates long, that 'u' indicates unsigned.

from The C Programming Language, pg 169

The type of an integer constant depends on its form, value and suffix. (See Par.A.4 for a discussion of types). If it is unsuffixed and decimal, it has the first of these types in which its value can be represented: int, long int, unsigned long int. If it is unsuffixed, octal or hexadecimal, it has the first possible of these types: int, unsigned int, long int, unsigned long int. If it is suffixed by u or U, then unsigned int, unsigned long int. If it is suffixed by l or L, then long int, unsigned long int. If an integer constant is suffixed by UL, it is unsigned long.

1 Like

Thanks gcjr so much; anything about demodulating sensor? because when i declare and use the pin (11U) with my IFSENSOR, got the print result "No decode" :smiling_face_with_tear:

suggest you look over the sample programs for IrReceiverSampler

2 Likes

Air conditioner? There are better libraries for them (long signals).
What board you have?

Yes, Air conditioner. I am using Arduino Nano

Try with this and post the output, receiver pin2

1 Like

Thanks, it works and i got this (but i dont know how to use/send it :upside_down_face: ) :

Select model to decode (this affects the IR signal timings detection):

  • '1' for Panasonic DKE>, Mitsubishi Electric, Fujitsu etc. codes

  • '2' for Panasonic CKP, Midea etc. codes

  • '3' for Mitsubishi Heavy etc. codes

  • '4' for Hyundai etc. codes

  • '5' for Samsung etc. codes

  • '6' for ZH/JG-01 codes

  • '9' for entering the bit sequence on the serial monitor (instead of the IR receiver)

Enter choice: 5

Ready to decode IR for choice '5'

################# Start

Number of symbols: 178

Symbols:

WHh01000000010010011111000000000000000000000000000000001111hHh10000000010010111111000000000000000000000000000000000000hHh10000000010000110111111110001110000000011010110000001111

Bytes:

00: 0100|0000 | 02 | 00000010

01: 0100|1001 | 92 | 10010010

02: 1111|0000 | 0F | 00001111

03: 0000|0000 | 00 | 00000000

04: 0000|0000 | 00 | 00000000

05: 0000|0000 | 00 | 00000000

06: 0000|1111 | F0 | 11110000

07: 1000|0000 | 01 | 00000001

08: 0100|1011 | D2 | 11010010

09: 1111|0000 | 0F | 00001111

10: 0000|0000 | 00 | 00000000

11: 0000|0000 | 00 | 00000000

12: 0000|0000 | 00 | 00000000

13: 0000|0000 | 00 | 00000000

14: 1000|0000 | 01 | 00000001

15: 0100|0011 | C2 | 11000010

16: 0111|1111 | FE | 11111110

17: 1000|1110 | 71 | 01110001

18: 0000|0001 | 80 | 10000000

19: 1010|1100 | 35 | 00110101

20: 0000|1111 | F0 | 11110000

02,92,0F,00,00,00,F0,01,D2,0F,00,00,00,00,01,C2,FE,71,80,35,F0

Timings (in us):

PAUSE SPACE: 17684

HEADER MARK: 3013

HEADER SPACE: 6512

BIT MARK: 506

ZERO SPACE: 445

ONE SPACE: 1446

Decoding known protocols...

Looks like a 21 bytes long Samsung protocol

POWER ON

Temperature: 24

FAN: 1 (low)

Checksum '0xC2' matches

################# End

Thanks! I tried, but I keep accepting these patterns that fluctuate 50/50:

UP:
+600 -17700 +2950 -8800 +500 -500 +500 -1450 +500 -500 +500 -500 +450 -550 +450 -500 +500 -500 +500 -450 +500 -500 +500 -1450 +500 -500 +500 -500 +450 -1500 +450 -500 +500 -500 +500 -1450 +500 -1450 +500 -1500 +450 -1500 +500 -1500 +450 -500 +500 -500 +500 -450 +500 -500 +500 -500 +450 -500 +500 -500 +500 -500 +450 -500 +500 -500 +500 -450 +500 -500 +500 -500 +450 -500 +500 -500 +500 -500 +450 -550 +450 -500 +500 -500 +500 -450 +500 -500 +500 -500 +450 -500 +500 -500 +500 -500 +450 -500 +500 -500 +450 -500 +500 -500 +500 -500 +450 -500 +500 -500 +500 -1500 +450 -1500 +500 -1450 +500 -1450 +500 -2950 +2950 -8850 +450 -1500 +500 -450 +500 -500 +500 -500 +450 -500 +500 -500 +500 -500 +450 -500 +500 -500 +450 -1500 +500 -500 +500 -500 +450 -500 +500 -500 +500 -1450 +500 -1450 +500 -500 +500 -1450 +500 -1500 +450 -1500 +450 -1500 +500 -1500 +450 -1500 +450 -1500 +500 -1450 +500 -500 +500 -500 +450 -500 +500 -1450 +500 -1500 +450 -1500 +500 -500 +450 -550 +450 -500 +450 -550 +450 -500 +500 -500 +450 -550 +450 -550 +450 -1500
DOWN:
+650 -17650 +2950 -8850 +450 -500 +500 -1500 +450 -550 +450 -500 +450 -550 +500 -450 +500 -500 +500 -500 +450 -500 +500 -1500 +450 -500 +500 -500 +450 -1500 +500 -500 +450 -500 +500 -1450 +500 -1500 +450 -1500 +500 -1500 +450 -1500 +500 -450 +500 -500 +500 -500 +450 -500 +500 -500 +500 -500 +450 -500 +500 -500 +500 -450 +500 -500 +500 -500 +450 -500 +500 -500 +500 -500 +450 -550 +450 -500 +500 -500 +500 -450 +500 -500 +500 -500 +450 -500 +500 -500 +500 -500 +450 -500 +500 -500 +450 -500 +500 -500 +500 -500 +450 -500 +500 -500 +500 -500 +450 -550 +450 -1500 +500 -1450 +500 -1450 +500 -1500 +450 -2950 +2950 -8850 +450 -1500 +500 -500 +450 -500 +500 -500 +500 -500 +450 -500 +500 -500 +450 -550 +450 -500 +500 -1500 +450 -500 +500 -500 +500 -500 +450 -500 +500 -1450 +500 -1500 +450 -500 +500 -1450 +500 -1500 +450 -1500 +500 -1500 +450 -1500 +450 -1500 +500 -1450 +500 -1500 +450 -500 +500 -500 +500 -450 +500 -1500 +450 -1500 +500 -1500 +450 -500 +450 -550 +450 -500 +500 -500 +450 -550 +450 -500 +500 -500 +500 -500 +450 -1500
OFF:
+600 -17600 +2950 -8850 +500 -500 +450 -1500 +500 -500 +450 -500 +500 -500 +500 -450 +500 -500 +500 -500 +450 -500 +500 -1500 +450 -500 +500 -500 +450 -1500 +500 -1500 +450 -500 +500 -1500 +450 -1500 +450 -1500 +500 -1450 +500 -1450 +500 -500 +500 -500 +450 -500 +500 -500 +500 -500 +450 -550 +450 -500 +450 -550 +450 -500 +500 -500 +500 -500 +450 -500 +500 -500 +500 -500 +450 -500 +500 -500 +500 -450 +500 -500 +500 -500 +450 -500 +500 -500 +500 -500 +450 -550 +450 -500 +450 -550 +450 -500 +500 -500 +500 -500 +450 -500 +500 -500 +500 -500 +450 -500 +500 -500 +500 -450 +500 -1500 +450 -1500 +500 -2950 +2900 -8850 +500 -1500 +450 -500 +500 -500 +500 -500 +450 -500 +500 -500 +500 -500 +450 -500 +500 -500 +500 -1450 +500 -500 +450 -500 +500 -1500 +450 -500 +500 -1450 +500 -1500 +450 -1500 +450 -1550 +450 -1500 +450 -1500 +500 -500 +450 -500 +500 -500 +500 -450 +500 -500 +500 -500 +450 -500 +500 -500 +500 -500 +450 -500 +500 -500 +450 -550 +450 -550 +450 -500 +500 -500 +450 -500 +500 -500 +500 -500 +450 -500 +500 -500

+300 -550 +400 -550 +450 -550 +450 -500 +500 -1500 +450 -1500 +450 -550 +450 -500 +500 -1450 +500 -1500 +450 -1500 +450 -500 +500 -500 +450 -550 +450 -550 +450 -500 +450 -550 +450 -550 +450 -500 +500 -1450 +500 -1500 +450 -30100
ON:
+650 -17550 +2950 -8850 +500 -500 +450 -1500 +500 -450 +500 -500 +500 -500 +450 -500 +500 -500 +500 -450 +500 -550 +450 -1500 +450 -500 +500 -500 +500 -1450 +500 -500 +500 -500 +450 -1500 +450 -1500 +500 -1450 +500 -1450 +500 -1500 +450 -500 +500 -500 +500 -500 +450 -550 +450 -500 +500 -500 +500 -450 +500 -500 +500 -500 +450 -500 +500 -500 +500 -500 +450 -500 +500 -500 +500 -450 +500 -500 +500 -500 +450 -500 +500 -500 +500 -500 +450 -550 +450 -500 +450 -550 +450 -500 +500 -500 +500 -500 +450 -500 +500 -500 +500 -500 +450 -500 +500 -500 +500 -450 +500 -1500 +450 -1500 +500 -1450 +500 -1500 +500 -2900 +2950 -8850 +450 -1500 +500 -500 +500 -500 +450 -500 +500 -500 +500 -450 +500 -500 +500 -500 +450 -500 +500 -1500 +450 -500 +500 -500 +450 -1500 +500 -500 +450 -1500 +500 -1500 +450 -1500 +450 -1500 +500 -1450 +500 -1500 +450 -500 +500 -500 +450 -500 +500 -500 +500 -500 +450 -500 +500 -500 +450 -550 +450 -550 +450 -500 +450 -550 +450 -500 +500 -500 +500 -500 +450 -500 +500 -500 +500 -500 +450 -500 +500 -500 +450 -500

+250 -500 +500 -500 +450 -550 +450 -1500 +450 -1500 +450 -550 +450 -500 +500 -1500 +450 -1500 +450 -1550 +400 -550 +450 -550 +400 -550 +500 -500 +450 -550 +450 -500 +450 -1500 +500 -1500 +450 -1500 +450 -1500 +450 -30100

UP:
+600 -17650 +3000 -8800 +500 -500 +500 -1450 +500 -500 +500 -450 +500 -500 +500 -500 +450 -550 +450 -500 +500 -500 +450 -1500 +500 -500 +500 -450 +500 -1500 +450 -500 +500 -500 +500 -1450 +500 -1450 +500 -1500 +450 -1500 +500 -1500 +450 -500 +450 -550 +450 -500 +500 -500 +500 -500 +450 -500 +500 -500 +500 -450 +500 -500 +500 -500 +450 -500 +500 -500 +500 -500 +450 -500 +500 -500 +450 -500 +500 -550 +450 -500 +450 -550 +450 -500 +500 -500 +450 -550 +450 -500 +500 -500 +500 -450 +500 -500 +500 -500 +450 -500 +500 -500 +500 -500 +450 -500 +500 -500 +500 -1450 +500 -1500 +450 -1500 +450 -1500 +500 -2950 +2950 -8850 +450 -1500 +450 -500 +500 -500 +500 -500 +450 -500 +500 -500 +500 -450 +500 -500 +500 -500 +450 -1500 +500 -500 +450 -550 +450 -500 +450 -550 +450 -1500 +500 -1450 +500 -500 +500 -1450 +500 -1450 +500 -1500 +450 -1500 +500 -1450 +500 -1500 +450 -1500 +450 -1500 +450 -550 +450 -550 +450 -500 +500 -1450 +500 -1500 +450 -1500 +500 -450 +500 -500 +500 -500 +450 -500 +500 -500 +500 -500 +450 -550 +450 -500 +450 -1550
DOWN:
+650 -17600 +2950 -8850 +500 -500 +450 -1500 +500 -500 +450 -550 +450 -500 +500 -500 +450 -550 +450 -500 +450 -550 +450 -1500 +500 -500 +450 -500 +500 -1450 +500 -500 +500 -500 +450 -1500 +500 -1450 +500 -1450 +500 -1500 +450 -1500 +500 -500 +450 -550 +450 -500 +500 -500 +500 -450 +500 -500 +500 -500 +450 -500 +500 -500 +500 -500 +450 -500 +500 -500 +450 -500 +500 -500 +500 -500 +450 -550 +450 -500 +500 -500 +450 -550 +450 -500 +500 -500 +500 -450 +500 -500 +500 -500 +450 -500 +500 -500 +500 -500 +450 -500 +500 -500 +450 -500 +500 -500 +500 -500 +450 -1500 +500 -1500 +450 -1500 +450 -1500 +500 -2900 +2950 -8850 +500 -1500 +450 -500 +500 -500 +450 -500 +500 -500 +500 -500 +450 -500 +500 -500 +500 -500 +450 -1500 +450 -550 +450 -500 +500 -500 +450 -550 +450 -1500 +500 -1450 +500 -500 +450 -1500 +500 -1450 +500 -1500 +450 -1500 +450 -1500 +500 -1500 +450 -1500 +450 -1500 +450 -550 +450 -500 +500 -500 +500 -1450 +500 -1500 +450 -1500 +450 -550 +450 -500 +500 -500 +450 -500 +500 -500 +450 -550 +450 -550 +450 -550 +400 -1550
OFF:
+600 -17550 +3000 -8850 +450 -500 +500 -1450 +500 -500 +500 -500 +450 -500 +500 -500 +500 -500 +450 -500 +500 -500 +500 -1450 +500 -500 +450 -550 +450 -1500 +450 -1500 +500 -500 +500 -1450 +500 -1450 +500 -1500 +450 -1500 +500 -1450 +500 -500 +450 -500 +500 -500 +500 -450 +500 -550 +450 -500 +450 -550 +450 -500 +500 -500 +500 -500 +450 -500 +500 -500 +500 -450 +500 -500 +500 -500 +450 -500 +500 -500 +500 -500 +450 -500 +500 -500 +500 -450 +500 -500 +500 -500 +450 -550 +450 -500 +500 -500 +450 -550 +450 -500 +500 -500 +500 -450 +500 -500 +500 -500 +450 -500 +500 -500 +500 -1450 +500 -1450 +500 -2950 +2950 -8850 +450 -1500 +500 -500 +450 -550 +450 -500 +500 -500 +500 -500 +450 -500 +500 -500 +450 -500 +500 -1500 +450 -500 +500 -500 +500 -1450 +500 -500 +450 -1500 +500 -1500 +450 -1500 +500 -1450 +500 -1450 +500 -1500 +450 -500 +500 -500 +500 -450 +500 -500 +500 -500 +450 -500 +500 -500 +500 -500 +450 -550 +450 -500 +450 -550 +450 -550 +450 -500 +500 -500 +450 -500 +500 -500 +500 -500 +450 -550 +450 -500 +500 -500

+250 -550 +450 -550 +450 -500 +500 -500 +450 -1500 +450 -1500 +500 -500 +450 -1500 +500 -500 +450 -1500 +450 -1500 +500 -500 +450 -550 +450 -500 +450 -550 +450 -550 +450 -550 +450 -500 +450 -550 +450 -1500 +450 -1500 +500 -30100
ON:
+600 -17600 +2950 -8850 +500 -500 +450 -1500 +500 -500 +450 -500 +500 -500 +500 -450 +500 -500 +500 -500 +450 -500 +500 -1500 +450 -550 +450 -500 +500 -1500 +450 -500 +500 -500 +500 -1450 +500 -1450 +500 -1450 +500 -1500 +450 -1500 +500 -500 +450 -500 +500 -500 +450 -550 +450 -550 +450 -500 +450 -550 +450 -500 +500 -500 +500 -500 +450 -500 +500 -500 +500 -450 +500 -500 +500 -500 +450 -500 +500 -500 +500 -500 +450 -500 +500 -500 +450 -500 +500 -550 +450 -500 +450 -550 +450 -500 +500 -500 +500 -500 +450 -500 +500 -500 +500 -450 +500 -500 +500 -500 +450 -1500 +500 -1450 +500 -1450 +500 -1500 +500 -2950 +2900 -8850 +500 -1500 +450 -500 +500 -500 +500 -450 +500 -500 +500 -500 +450 -500 +500 -500 +500 -500 +450 -1500 +500 -450 +500 -500 +500 -1450 +500 -500 +500 -1500 +450 -1500 +450 -1500 +500 -1450 +500 -1500 +450 -1500 +450 -500 +500 -500 +500 -500 +450 -500 +500 -500 +500 -500 +450 -550 +450 -500 +450 -550 +450 -550 +450 -500 +500 -500 +450 -500 +500 -500 +500 -500 +450 -500 +500 -500 +450 -500 +500 -500 +500 -500

+200 -550 +450 -500 +500 -500 +450 -1500 +500 -1450 +500 -500 +450 -1500 +500 -500 +450 -1500 +450 -1500 +500 -500 +450 -550 +450 -550 +450 -500 +500 -500 +450 -550 +450 -1500 +450 -1500 +450 -1500 +500 -1500 +450 -30100

idk why... too tried use the class MultiDecoder from Infrared, but dont works:

timeout
timeout
No decode
No decode
No decode
No decode
No decode
No decode
No decode
No decode
timeout

Ok, it looks good.
168bit Samsung protocol
Lsb hex: 02,92,0F,00,00,00,F0,01,D2,0F,00,00,00,00,01,C2,FE,71,80,35,F0

Now try to send commands with samsung library.
Install library, from examples open CarrierTest.ino, substitute all Carrier... lines with SamsungHeatpumpIR

1 Like

It Works !!! Thanks so muchhhh... now i will ajdust the code :hammer:

I decoded that samsung protocol 10 years ago :wink:
Good luck!

1 Like

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