Boa tarde!
Estou tentando fazer a leitura de um controle remoto IR.
Estou usando um Nodemcu esp8266 e um receptor de IR VS1838 ligado direto na porta D1, GND e VCC conforme abaixo:
Depois preciso enviar o resultado dessa leitura via “irsend.sendRaw(BTNPRESSED, tamanho, frequencia)”
unsigned int BTNPRESSED[68] = {…LINHA RAW CORRESPONDENTE…};
#include <IRremoteESP8266.h>
#include <IRrecv.h>
#include <IRutils.h>
const uint32_t kBaudRate = 115200;
const uint16_t kRecvPin = D1;
const uint16_t kCaptureBufferSize = 1024;
const uint8_t kTimeout = 50;
const uint16_t kMinUnknownSize = 12;
IRrecv irrecv(kRecvPin, kCaptureBufferSize, kTimeout, true);
decode_results results;
void setup() {
Serial.begin(kBaudRate);
while (!Serial) {
delay(50);
}
irrecv.setUnknownThreshold(kMinUnknownSize);
irrecv.enableIRIn(); // Start the receiver
}
void loop() {
if (irrecv.decode(&results)) {
if (results.overflow) {
Serial.printf(“Buffer Overflow: %d\n”, kCaptureBufferSize);
}
Serial.print("\nLibrary : v" _IRREMOTEESP8266_VERSION_ "\n");
Serial.print("\nresultToHumanReadableBasic(&results): ");
Serial.print("\n" + resultToHumanReadableBasic(&results));
Serial.print("\nresultToSourceCode(&results): ");
Serial.print("\n" + resultToSourceCode(&results));
irrecv.resume();
Serial.println("================================");
delay(1000);
}
}
Estou enfrentando problemas pois as diversas leituras de um mesmo botão
trazem resultados diferentes.
============> Leitura 01 <===== Toque rápido no botão do controle
Library : v2.6.5
resultToHumanReadableBasic(&results):
Encoding : SAMSUNG
Code : E0E040BF (32 bits)
resultToSourceCode(&results):
uint16_t rawData[67] = {4498, 4530, 536, 1730, 510, 1734, 508, 1734, 510, 612, 506, 612, 514, 610, 506, 546, 576, 614, 506, 1736, 510, 1732, 508, 1734, 508, 532, 588, 614, 508, 614, 506, 614, 506, 614, 510, 614, 506, 1736, 508, 602, 520, 612, 512, 610, 506, 614, 508, 614, 506, 590, 530, 1736, 508, 612, 506, 1736, 506, 1736, 508, 1736, 508, 1736, 506, 1734, 508, 1736, 508}; // SAMSUNG E0E040BF
uint32_t address = 0x7;
uint32_t command = 0x2;
uint64_t data = 0xE0E040BF;
============> Leitura 02 <===== Toque rápido no botão do controle
Library : v2.6.5
resultToHumanReadableBasic(&results):
Encoding : SAMSUNG
Code : E0E040BF (32 bits)
resultToSourceCode(&results):
uint16_t rawData[67] = {4500, 4536, 530, 1736, 506, 1738, 506, 1738, 506, 590, 532, 616, 506, 590, 530, 588, 534, 592, 530, 1736, 506, 1738, 506, 1738, 506, 588, 532, 592, 532, 588, 534, 590, 530, 592, 530, 592, 528, 1736, 508, 588, 532, 588, 532, 590, 532, 590, 532, 588, 532, 590, 532, 1736, 506, 590, 536, 1732, 506, 1736, 506, 1736, 506, 1736, 508, 1736, 506, 1736, 508}; // SAMSUNG E0E040BF
uint32_t address = 0x7;
uint32_t command = 0x2;
uint64_t data = 0xE0E040BF;
============> Leitura 03 <===== Toque um pouco mais demorado no botão do controle
Library : v2.6.5
resultToHumanReadableBasic(&results):
Encoding : SAMSUNG
Code : E0E040BF (32 bits)