看板 ASM 關於我們 聯絡資訊
最近在做一個專題 希望在arduino上面裝上紅外線接收以及發射器 紅外線發射器 http://ppt.cc/1ezL 紅外線接收器(VS1838B) http://ppt.cc/oBGK 我使用的是MEGA2560 所以紅外線發射器的訊號腳我直接接在Pin9上面 然後我使用的library是Ken Shirriff的IRremote.h 單接接射器時可以正常運作 同一塊板子同時放上接收跟發射器時 發射器的功能正常 但接收器卻無法順利接收 程式如下 #include <IRremote.h> IRsend irsend; int RECV_PIN = 11; IRrecv irrecv(RECV_PIN); decode_results results; void setup() { Serial.begin(9600); Serial.println("Send Start!"); irrecv.enableIRIn(); // Start the receiver pinMode(11,INPUT); } void loop() { irsend.sendSony(0xa00,12); delay(40); check(); } void check() { if (irrecv.decode(&results)) { Serial.println(results.value); } } 有沒有人也碰過類似的問題 -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 140.116.226.87
ksmrt0123:decode 成功後應該需要 irrecv.resume(); 02/19 00:07
emmaghost:這行我有寫 是複製過來時沒複製到 02/19 01:46
will3509111:大大你check每40微秒一次他抓不到啦 02/22 19:49
ksmrt0123:irsend/irrecv會用到同一個timer衝到了 02/26 00:30