问题描述
我试图让 arduino Uno 和 Mega 通过 IR 相互通信,但我无法解密输出。
联合国代码:
#include <IRremote.h>
IRsend irsend;
void setup() {
// put your setup code here,to run once:
}
void loop() {
// put your main code here,to run repeatedly:
for(int i = 0; i < 200; i++){
irsend.sendRC5(i,3);
delay(500);
}
}
超级代码:
#include <IRremote.h>
#define RECV_PIN 3
IRrecv irrecv(RECV_PIN);
decode_results results;
void setup() {
Serial.begin(9600);
irrecv.enableIRIn();
}
void loop() {
if (irrecv.decode(&results)){
int state;
if ( results.value == 1 ){
state = HIGH;
}
else{
state = LOW;
}
Serial.println(results.value,DEC);
irrecv.resume();
}
}
串行输出:
08:59:57.562 -> 819043197
08:59:58.072 -> 4239130558
08:59:58.586 -> 4092259158
08:59:59.094 -> 1271936904
08:59:59.604 -> 1322269761
09:00:00.119 -> 3687369585
09:00:00.625 -> 1513342804
09:00:01.136 -> 869376052
09:00:01.648 -> 819043197
09:00:02.157 -> 4239130558
09:00:02.669 -> 4092259158
09:00:03.180 -> 1271936904
09:00:03.691 -> 1322269761
是否有某种解密功能,或者我是否必须手动映射每个输出,以获得 500 个输出?我有可以返回该范围内任何值的操纵杆。p>
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)