0
I have two Arduino boards. One is connected to an IR transmitter and the other is connected to an IR receiver.
I have the IRremoteESP8266: IRrecvDumpV3
application running on the receiver board which seems to work ok, as when i press one of my IR remote controls, it prints out consistent data based on each button press.
However, I am trying to a create an application on the transmitter end which for a start has hard-coded hex string as commands there to test in a loop, which get converted to uint64 values and sent to the sendElitescreens()
function and transmitter as below. The uint64 values are correct before sending.
#include <ESP8266WiFi.h>
#include <ESP8266WebServer.h>
#include <ESP8266SSDP.h>
#include <uri/UriBraces.h>
#include <IRremoteESP8266.h>
#include <IRsend.h>
#include <OneWire.h>
#include <DallasTemperature.h>
const uint16_t kIrLed = 5; // ESP8266 GPIO pin to use. Recommended: 4 (D2).
int LED = 4; // Assign LED pin i.e: D2 on NodeMCU
// GPIO where the DS18B20 is connected to
const int oneWireBus = 2;
// Setup a oneWire instance to communicate with any OneWire devices
OneWire oneWire(oneWireBus);
// Pass our oneWire reference to Dallas Temperature sensor
DallasTemperature sensors(&oneWire);
IRsend irsend(kIrLed);
void setup() {
sensors.begin();
pinMode(LED, OUTPUT);
irsend.begin();
Serial.begin(115200);
}
uint64_t stringToUint_64(String value) {
int stringLenght = value.length();
uint64_t uint64Value = 0x0;
for(int i = 0; i<=stringLenght-1; i++) {
char charValue = value.charAt(i);
uint64Value = 0x10 * uint64Value;
uint64Value += stringToHexInt(charValue);
}
Serial.print("string to int is");
Serial.println(uint64Value);
return uint64Value;
}
int stringToHexInt(char value) {
switch(value) {
case '0':
return 0;
break;
case '1':
return 0x1;
break;
case '2':
return 0x2;
break;
case '3':
return 0x3;
break;
case '4':
return 0x4;
break;
case '5':
return 0x5;
break;
case '6':
return 0x6;
break;
case '7':
return 0x7;
break;
case '8':
return 0x8;
break;
case '9':
return 0x9;
break;
case 'A':
case 'a':
return 0xA;
break;
case 'B':
case 'b':
return 0xB;
break;
case 'C':
case 'c':
return 0xC;
break;
case 'D':
case 'd':
return 0xD;
break;
case 'E':
case 'e':
return 0xE;
break;
case 'F':
case 'f':
return 0xF;
break;
}
return 0;
}
void loop() {
String up_command = "FDA2256";
String down_command = "FBA1136";
String stop_command = "FEA3387";
Serial.println("In loop - sending commands ..");
// Send each screen command and wait for 4 seconds
digitalWrite(LED, HIGH); // turn the LED on
//Serial.println("Up");
//Serial.println(up_command);
irsend.sendElitescreens(stringToUint_64(up_command));
digitalWrite(LED, LOW); // turn the LED off
delay(4000);
digitalWrite(LED, HIGH); // turn the LED on
//Serial.println("Down");
//Serial.println(down_command);
irsend.sendElitescreens(stringToUint_64(down_command));
digitalWrite(LED, LOW); // turn the LED off
delay(4000);
digitalWrite(LED, HIGH); // turn the LED on
//Serial.println("Stop");
//Serial.println(stop_command);
irsend.sendElitescreens(stringToUint_64(stop_command));
digitalWrite(LED, LOW); // turn the LED off
delay(4000);
}
The dump received on the IRrecvDumpV3 doesn't make any sense unfortunately. The hex values don't match and are changing all the time as below.
Am I doing something fundamentally wrong here? Thanks in advance for any support.
Timestamp : 000065.309
Library : v2.8.6
Protocol : UNKNOWN
Code : 0xC7BEF4CD (24 Bits)
uint16_t rawData[47] = {294, 13074, 278, 2678, 106, 3600, 128, 168, 182, 2812, 496, 15370, 126, 136, 478, 740, 474, 6344, 256, 9350, 470, 17040, 196, 4726, 128, 4016, 300, 2520, 232, 430, 260, 5484, 202, 9052, 528, 2536, 306, 536, 162, 4418, 232, 6456, 184, 2698, 164, 4792, 260}; // UNKNOWN C7BEF4CD
Timestamp : 000069.510
Library : v2.8.6
Protocol : UNKNOWN
Code : 0xAF8A3196 (117 Bits)
uint16_t rawData[233] = {136, 490, 960, 612, 276, 124, 2650, 838, 2304, 192, 5306, 120, 440, 522, 4792, 560, 1092, 150, 440, 336, 7364, 124, 1320, 934, 1046, 356, 4644, 526, 476, 146, 2174, 324, 802, 442, 428, 208, 124, 198, 898, 388, 2552, 924, 580, 464, 2314, 446, 534, 148, 648, 370, 1426, 340, 736, 188, 2548, 550, 180, 734, 128, 328, 140, 248, 776, 1354, 180, 154, 1372, 290, 650, 128, 898, 408, 1254, 620, 618, 554, 570, 716, 182, 242, 2116, 1298, 1048, 246, 1588, 168, 266, 310, 548, 266, 1794, 180, 1228, 702, 1108, 260, 576, 116, 122, 298, 362, 408, 448, 490, 200, 690, 1066, 522, 1524, 208, 1244, 586, 280, 810, 346, 120, 256, 980, 474, 722, 570, 650, 480, 1248, 518, 158, 294, 154, 264, 1778, 980, 810, 248, 636, 292, 164, 366, 428, 126, 1148, 102, 210, 792, 968, 764, 432, 332, 566, 848, 596, 212, 904, 868, 1064, 216, 568, 106, 332, 502, 712, 194, 152, 140, 548, 208, 220, 842, 2728, 458, 802, 706, 1348, 1082, 188, 350, 566, 130, 722, 404, 158, 346, 766, 430, 2454, 196, 368, 700, 412, 328, 1388, 512, 674, 600, 794, 122, 1634, 114, 1242, 176, 268, 410, 984, 132, 294, 138, 274, 390, 252, 428, 1194, 224, 346, 324, 442, 142, 1752, 402, 838, 294, 338, 134, 870, 354, 1634, 338, 1080, 236, 234, 266, 182, 564, 610, 254}; // UNKNOWN AF8A3196
Timestamp : 000086.112
Library : v2.8.6
Protocol : UNKNOWN
Code : 0xE3EA772A (37 Bits)
uint16_t rawData[73] = {2456, 156, 1922, 174, 690, 618, 1620, 258, 368, 416, 236, 1298, 312, 1320, 446, 45914, 148, 2240, 204, 1094, 210, 942, 132, 2448, 202, 654, 262, 658, 160, 518, 616, 622, 832, 142, 260, 1772, 606, 128, 234, 374, 896, 388, 1078, 984, 842, 1448, 2342, 2590, 148, 196, 1522, 1138, 1406, 124, 208, 414, 1288, 278, 198, 1188, 182, 302, 780, 680, 1048, 260, 288, 380, 274, 1398, 116, 458, 172};