Received Raw signal displayed in Serial Monitor is different from the sent raw IR signal

Hi!

I

I am trying to send back a RAW IR signal I got from a Panasonic AC Remote. Upon trying to the AC unit itself, it fails to control the unit. I created a simple receiver that displays the signal received in the serial monitor. On the monitor, the RAW data displayed is different from the one I sent. And an error message is displayed:

C:\Users\ACER\AppData\Local\Temp\arduino_modified_sketch_437114\SendRawDemo.ino: In function 'void loop()':
C:\Users\ACER\AppData\Local\Temp\arduino_modified_sketch_437114\SendRawDemo.ino:120:55: warning: large integer implicitly truncated to unsigned type [-Woverflow]
IrSender.sendRaw_P(irSignalON, sizeof(irSignalON) / sizeof(irSignalON[0]), NEC_KHZ);
~~~~~^
C:\Users\ACER\AppData\Local\Temp\arduino_modified_sketch_437114\SendRawDemo.ino:131:57: warning: large integer implicitly truncated to unsigned type [-Woverflow]
IrSender.sendRaw_P(irSignalOFF, sizeof(irSignalOFF) / sizeof(irSignalOFF[0]), NEC_KHZ);
~~~~~~^

Here is my code:

#include <Arduino.h>

/*

  • Define macros for input and output pin etc.
    */
    #include "PinDefinitionsAndMore.h"

#include <IRremote.hpp>

// On the Zero and others we switch explicitly to SerialUSB
#if defined(ARDUINO_ARCH_SAMD)
#define Serial SerialUSB
#endif

void setup() {
pinMode(LED_BUILTIN, OUTPUT);

Serial.begin(115200);

#if defined(AVR_ATmega32U4) || defined(SERIAL_USB) || defined(SERIAL_PORT_USBVIRTUAL) || defined(ARDUINO_attiny3217)
delay(4000); // To be able to connect Serial monitor after reset or power up and before first print out. Do not wait for an attached Serial Monitor!
#endif
// Just to know which program is running on my Arduino
Serial.println(F("START " FILE " from " DATE "\r\nUsing library version " VERSION_IRREMOTE));

#if defined(IR_SEND_PIN)
IrSender.begin(); // Start with IR_SEND_PIN as send pin and enable feedback LED at default feedback LED pin
#else
IrSender.begin(IR_SEND_PIN, ENABLE_LED_FEEDBACK); // Specify send pin and enable feedback LED at default feedback LED pin
#endif

Serial.print(F("Ready to send IR signals at pin "));

#if defined(ARDUINO_ARCH_STM32) || defined(ESP8266)
Serial.println(IR_SEND_PIN_STRING);
#else
Serial.print(IR_SEND_PIN);
#endif
}

/*

  • NEC address=0xFB0C, command=0x18
  • This is data in byte format.
  • The uint8_t/byte elements contain the number of ticks in 50 us.
  • The uint16_t format contains the (number of ticks * 50) if generated by IRremote,
  • so the uint16_t format has exact the same resolution but requires double space.
  • With the uint16_t format, you are able to modify the timings to meet the standards,
  • e.g. use 560 (instead of 11 * 50) for NEC or use 432 for Panasonic. But in this cases,
  • you better use the timing generation functions e.g. sendNEC() directly.
    */
    const unsigned int irSignalON PROGMEM
    = {3480, 1732, 440, 432, 440, 1296, 440, 428, 440, 432, 440, 428, 440, 428, 440, 432, 436, 432, 440, 428, 440, 428, 440, 428, 440, 432, 440, 428, 440, 1300, 436, 432, 440, 428, 440, 428, 440, 432, 436, 432, 436, 432, 440, 428, 440, 1300, 440, 1296, 440, 1300, 436, 432, 440, 428, 440, 1300, 440, 428, 440, 428, 440, 428, 440, 432, 436, 432, 440, 428, 440, 428, 440, 432, 440, 428, 440, 428, 440, 428, 440, 432, 436, 432, 440, 428, 440, 428, 440, 432, 436, 432, 440, 428, 440, 428, 440, 428, 444, 428, 440, 428, 440, 428, 440, 428, 440, 432, 440, 428, 440, 428, 440, 432, 436, 432, 440, 428, 440, 1296, 440, 1300, 440, 428, 440, 428, 440, 432, 440, 428, 440, 428, 440, 9988, 3480, 1732, 444, 428, 440, 1296, 440, 432, 436, 432, 440, 428, 440, 428, 440, 432, 436, 432, 440, 428, 440, 432, 436, 432, 440, 428, 440, 428, 440, 1300, 436, 432, 440, 428, 440, 428, 440, 432, 436, 432, 440, 428, 440, 428, 440, 1300, 440, 1296, 440, 1300, 440, 428, 440, 428, 440, 1300, 440, 428, 440, 428, 440, 428, 440, 432, 440, 428, 440, 428, 440, 428, 440, 432, 440, 428, 440, 428, 440, 428, 440, 428, 444, 428, 440, 1296, 440, 432, 440, 428, 440, 1296, 440, 1300, 440, 1296, 440, 432, 440, 428, 440, 428, 440, 432, 436, 428, 444, 428, 440, 428, 440, 1296, 444, 428, 440, 428, 440, 428, 440, 428, 440, 432, 440, 428, 440, 428, 440, 432, 436, 432, 440, 1296, 440, 432, 436, 1300, 440, 428, 440, 428, 440, 1300, 440, 1296, 444, 1296, 440, 428, 440, 428, 440, 432, 440, 428, 440, 428, 440, 432, 436, 432, 440, 428, 440, 428, 440, 428, 440, 432, 440, 428, 440, 428, 440, 428, 440, 432, 440, 428, 440, 428, 440, 428, 440, 1300, 440, 1296, 440, 1300, 440, 428, 440, 428, 440, 432, 440, 428, 440, 428, 440, 428, 440, 432, 440, 428, 440, 428, 440, 1300, 440, 1296, 440, 1300, 440, 428, 440, 428, 440, 428, 440, 432, 440, 428, 440, 428, 440, 428, 440, 428, 444, 428, 440, 428, 440, 428, 440, 432, 440, 428, 440, 428, 440, 428, 440, 428, 440, 1300, 440, 428, 440, 428, 440, 432, 440, 428, 440, 428, 440, 432, 440, 1296, 440, 428, 440, 428, 440, 432, 440, 428, 440, 428, 440, 428, 444, 428, 440, 428, 440, 428, 440, 432, 436, 432, 440, 428, 440, 428, 440, 428, 440, 432, 440, 428, 440, 428, 440, 428, 440, 432, 440, 428, 440, 428, 440, 432, 436, 1300, 440, 1296, 444};
type or paste code here

const unsigned int irSignalOFF PROGMEM={3480, 1736, 436, 432, 436, 1304, 436, 432, 436, 432, 436, 432, 440, 432, 436, 432, 436, 432, 436, 436, 436, 428, 440, 428, 440, 432, 436, 432, 440, 1300, 436, 432, 436, 432, 440, 428, 440, 432, 436, 428, 440, 432, 440, 428, 440, 1300, 436, 1300, 440, 1300, 436, 432, 440, 428, 440, 1296, 440, 432, 436, 432, 440, 428, 440, 432, 436, 432, 436, 432, 440, 428, 440, 432, 436, 428, 440, 432, 440, 428, 440, 432, 436, 432, 440, 428, 440, 428, 440, 432, 436, 432, 436, 432, 440, 428, 440, 432, 436, 432, 436, 432, 440, 428, 440, 428, 440, 432, 440, 428, 440, 428, 440, 428, 440, 432, 436, 432, 440, 1296, 440, 1300, 440, 428, 440, 428, 440, 428, 440, 432, 440, 428, 440, 9992, 3484, 1732, 440, 428, 440, 1300, 440, 428, 440, 428, 440, 428, 440, 432, 440, 428, 440, 428, 440, 428, 440, 432, 440, 428, 440, 428, 440, 432, 436, 1300, 440, 428, 440, 432, 436, 432, 440, 428, 440, 428, 440, 428, 440, 432, 436, 1300, 440, 1300, 440, 1296, 440, 428, 440, 428, 440, 1300, 440, 428, 440, 428, 444, 428, 440, 428, 440, 428, 440, 428, 440, 432, 440, 428, 440, 428, 440, 428, 440, 432, 440, 428, 440, 428, 440, 428, 440, 432, 440, 428, 440, 1300, 436, 1300, 440, 1296, 440, 432, 440, 428, 440, 428, 440, 428, 440, 432, 440, 428, 440, 428, 440, 1300, 508, 360, 440, 428, 440, 428, 440, 428, 440, 432, 444, 424, 440, 428, 440, 432, 440, 428, 440, 1296, 440, 432, 440, 1296, 440, 428, 440, 428, 440, 1300, 440, 1300, 440, 1296, 440, 428, 440, 432, 440, 428, 440, 428, 440, 428, 444, 428, 436, 432, 440, 428, 440, 432, 436, 432, 440, 428, 440, 428, 440, 428, 440, 432, 440, 428, 440, 428, 440, 428, 440, 432, 440, 1296, 440, 1300, 440, 1296, 440, 432, 436, 432, 440, 428, 440, 428, 440, 428, 444, 424, 444, 428, 440, 428, 440, 432, 436, 1300, 440, 1296, 440, 1300, 440, 428, 440, 432, 436, 432, 440, 428, 440, 428, 440, 432, 436, 432, 440, 428, 440, 428, 440, 428, 440, 432, 440, 428, 440, 428, 440, 428, 444, 428, 440, 428, 440, 1296, 444, 428, 440, 428, 440, 428, 440, 428, 440, 432, 440, 428, 440, 1296, 440, 428, 444, 428, 440, 428, 440, 428, 440, 432, 440, 428, 440, 428, 440, 428, 440, 428, 444, 428, 440, 432, 436, 428, 440, 428, 444, 428, 440, 428, 440, 428, 440, 1300, 440, 1296, 440, 1300, 440, 1296, 440, 1300, 440, 1296, 440, 428, 444, 1296, 440
};

void loop() {

//#if !(defined(AVR_ATtiny25) || defined(AVR_ATtiny45) || defined(AVR_ATtiny85))
/*
* Send hand crafted data from RAM
* The values are NOT multiple of 50, but are taken from the NEC timing definitions
*/
// Serial.println(F("Send NEC 16 bit address=0xFB04 and command 0x08 with exact timing (16 bit array format)"));
// Serial.flush();

// const uint16_t irSignal = { 9000, 4500/Start bit/, 560, 560, 560, 560, 560, 1690, 560,
// 560/0010 0x4 of 16 bit address LSB first/, 560, 560, 560, 560, 560, 560, 560, 560/0000/, 560, 1690, 560, 1690, 560,
// 560, 560, 1690/1101 0xB/, 560, 1690, 560, 1690, 560, 1690, 560, 1690/1111/, 560, 560, 560, 560, 560, 560, 560,
// 1690/0001 0x08 of command LSB first/, 560, 560, 560, 560, 560, 560, 560, 560/0000 0x00/, 560, 1690, 560, 1690, 560,
// 1690, 560, 560/1110 Inverted 8 of command/, 560, 1690, 560, 1690, 560, 1690, 560, 1690/1111 inverted 0 of command/,
// 560 /stop bit/}; // Using exact NEC timing
// IrSender.sendRaw(irSignal, sizeof(irSignal) / sizeof(irSignal[0]), NEC_KHZ); // Note the approach used to automatically calculate the size of the array.

// delay(1000); // delay must be greater than 5 ms (RECORD_GAP_MICROS), otherwise the receiver sees it as one long signal
//#endif

/*
 * Send byte data direct from FLASH
 * Note the approach used to automatically calculate the size of the array.
 */
Serial.println(F("Send NEC 16 bit address 0xFB0C and data 0x18 with (50 us) tick resolution timing (8 bit array format) "));
Serial.flush();
IrSender.sendRaw_P(irSignalON, sizeof(irSignalON) / sizeof(irSignalON[0]), NEC_KHZ);

delay(5000); // delay must be greater than 5 ms (RECORD_GAP_MICROS), otherwise the receiver sees it as one long signal

Serial.println(F("Send NEC 16 bit address 0x0102, 8 bit data 0x34 with generated timing"));
Serial.flush();
IrSender.sendNEC(0x0102, 0x34, true, 0);

Serial.println(F("Send NEC 16 bit address 0xFB0C and data 0x18 with (50 us) tick resolution timing (8 bit array format) "));
Serial.flush();
IrSender.sendRaw_P(irSignalOFF, sizeof(irSignalOFF) / sizeof(irSignalOFF[0]), NEC_KHZ);

delay(5000); // delay must be greater than 5 ms (RECORD_GAP_MICROS), otherwise the receiver sees it as one long signal

Serial.println(F("Send NEC 16 bit address 0x0102, 8 bit data 0x34 with generated timing"));
Serial.flush();
IrSender.sendNEC(0x0102, 0x34, true, 0);



delay(3000);

}

Hi, @jimothyhalpert12
Welcome to the forum.

Please read the post at the start of any forum , entitled "How to use this Forum".

This will help with advice on how to present your code and problems.

You can go back to your first post and put your code in code tags as per the above instructions.

Thanks.. Tom... :grinning: :+1: :coffee: :australia: