07-06-2022, 01:04 AM
[Arduino IDE demo source code for KC868-AI]--#02-KC868-AI_IR receive_code
Code:
#include <WiFiUdp.h>
#include "PinDefinitionsAndMore.h"
#include <IRremote.h>
void setup()
{
Serial.begin(115200);
Serial.println();
IrReceiver.begin(IR_RECEIVE_PIN, ENABLE_LED_FEEDBACK, USE_DEFAULT_FEEDBACK_LED_PIN);
}
void loop()
{
if (IrReceiver.decode()) {
// Print a short summary of received data
IrReceiver.printIRResultShort(&Serial);
if (IrReceiver.decodedIRData.protocol == UNKNOWN) {
// We have an unknown protocol here, print more info
IrReceiver.printIRResultRawFormatted(&Serial, true);
}
Serial.println();
IrReceiver.resume(); // Enable receiving of the next value
}
delay(30);
}