最近在做一个专题
希望在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);
}
}
有没有人也碰过类似的问题