ESPMegaPRO-v3-SDK/ESPMegaPRO-OS-SDK/src/rmt_demo.cpp.disabled

29 lines
1.4 KiB
Plaintext

#include <ESPMegaProOS.hpp>
#include <IRBlaster.hpp>
#include <IRReceiver.hpp>
ESPMegaPRO espmega = ESPMegaPRO();
IRBlaster irBlaster = IRBlaster(4);
uint16_t data[] = { 2441, 579, 621, 580, 620, 580, 620, 580, 621, 579, 621, 579, 1220, 580, 1220, 580, 1247, 554, 619, 580, 621, 580, 619, 581, 619, 26392, 2420, 580, 621, 580, 620, 579, 620, 581, 619, 581, 620, 580, 1219, 581, 1220, 580, 1220, 581, 619, 580, 620, 580, 620, 580, 621, 26385, 2421, 580, 621, 580, 620, 580, 620, 579, 621, 579, 621, 579, 1221, 579, 1221, 580, 1219, 580, 621, 580, 620, 580, 621, 579, 621, 26385, 2421, 580, 621, 579, 620, 580, 620, 580, 621, 579, 621, 579, 1221, 579, 1221, 580, 1219, 580, 621, 580, 620, 580, 620, 580, 621, 26384, 2422, 580, 621, 579, 621, 579, 620, 580, 620, 580, 621, 579, 1221, 579, 1221, 580, 1220, 580, 620, 580, 620, 579, 620, 581, 620};
void setup() {
espmega.begin();
IRReceiver::begin(15);
irBlaster.send(data, sizeof(data)/sizeof(uint16_t));
}
void loop() {
Serial.println("Starting long receive");
IRReceiver::start_long_receive();
delay(5000);
Serial.println("Ending long receive");
ir_data_t data = IRReceiver::end_long_receive();
Serial.printf("Recived %d data points\n", data.size);
for (size_t i = 0; i < data.size; i++) {
Serial.print(data.data[i]);
Serial.print(i == data.size-1 ? "\n" : ", ");
}
free(data.data);
}