7. 红外遥控



Last updated
Was this helpful?



Last updated
Was this helpful?
Was this helpful?
#include <Arduino.h>
#include <IRremote.h>
int RECV_PIN = 23;
IRrecv irrecv(RECV_PIN);
decode_results results;
void setup() {
Serial.begin(115200);
irrecv.enableIRIn();
Serial.println("IR Receiver ready");
}
void loop() {
if (irrecv.decode(&results)) {
Serial.println(results.value, HEX);
Serial.print(" - ");
irrecv.resume(); // Receive the next value
}
delay(300);
}