Hey y'all, I've had an Arduino Uno turning my AC on and off for a while now and I decided to switch to ESP32 to make a wireless system.
I wrote the simplest version of the Uno code to use on the ESP32 as a starting point and there is already an issue I can't solve.
I am using "sendPulseDistanceWidthFromArray" from the IRRemote library with specific values for my AC because this was the only way it worked when I first wrote the program.
The command looks like this
IrSender.sendPulseDistanceWidthFromArray(38, 3000, 1600, 400, 1100, 400, 400, tRawDataOn, 112, PROTOCOL_IS_LSB_FIRST, 0, 0);
And this is the tRawDataOn array variable
const IRRawDataType tRawDataOn[] = {0x126CB23, 0x7022400, 0x0, 0x4200};
After this failing to work, I attempted to decode the signal with the same receiver I used to get the codes from my remote and saw the following:
The remote's RawDataType array looks like this
uint32_t tRawData[]={0x126CB23, 0x7022400, 0x0, 0x4200}
When received
However, the ESP32's RawDataType array looks like this
uint32_t tRawData[]={0x126CB23, 0x0, 0x7022400, 0x0}
I'm trying to figure out what is causing this array shift or how to mitigate it.
This is the complete file
Code
#define IR_SEND_PIN 4
#include <IRremote.hpp>
const IRRawDataType tRawDataOn[] = {0x126CB23, 0x7022400, 0x0, 0x4200};
const IRRawDataType tRawDataTimer[] = {0x126CB23, 0xF022C00, 0x340, 0x9500};
float temp = 30.00; //Testing
void setup() {
IrSender.begin();
}
void loop() {
if(temp > 28.00){
IrSender.sendPulseDistanceWidthFromArray(38, 3000, 1600, 400, 1100, 400, 400, tRawDataOn, 112, PROTOCOL_IS_LSB_FIRST, 0, 0);
delay(2000);
IrSender.sendPulseDistanceWidthFromArray(38, 3000, 1600, 400, 1100, 400, 400, tRawDataTimer, 112, PROTOCOL_IS_LSB_FIRST, 0, 0);
delay(5000); //Testing
}
}
If you have any suggestions, even if they aren't a fix, please let me know. I am open to changing the whole program as long as it functions properly with my AC.