27 lines
728 B
C++
27 lines
728 B
C++
|
#include <ESPMegaProOS.hpp>
|
||
|
#include <IRBlaster.hpp>
|
||
|
#include <IRReceiver.hpp>
|
||
|
|
||
|
ESPMegaPRO espmega = ESPMegaPRO();
|
||
|
IRBlaster irBlaster = IRBlaster(14);
|
||
|
|
||
|
void setup() {
|
||
|
espmega.begin();
|
||
|
IRReceiver::begin(15);
|
||
|
uint16_t data[] = {100, 200, 300, 400, 500};
|
||
|
irBlaster.send(data, 5);
|
||
|
}
|
||
|
|
||
|
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);
|
||
|
}
|