注意:使用的是數字輸出,不是模擬量輸出
VCC 對應電路板上的Power supply,vin的電壓是5V也可以使用
程序:
/* * IRremote: IRrecvDemo - demonstrates receiving IR codes with IRrecv * An IR detector/demodulator must be connected to the input RECV_PIN. * Version 0.1 July, 2009 * Copyright 2009 Ken Shirriff * http://arcfn.com */ #include <IRremote.h> // IRremote庫聲明 int RECV_PIN = 3; //定義紅外接收器的引腳為11 IRrecv irrecv(RECV_PIN); decode_results results; void setup() { Serial.begin(9600); irrecv.enableIRIn(); // 啟動接收器 } void loop() { if (irrecv.decode(&results)) { Serial.println(results.value, HEX);//以16進制換行輸出接收代碼 irrecv.resume(); // 接收下一個值 } delay(100); }