红外传感器
红外传感器 示例代码
#include<IRremote.h>
long ir_value;
IRrecv iRrecv(A0);
decode_results results;
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
iRrecv.enableIRIn();
}
void loop() {
// put your main code here, to run repeatedly:
if(iRrecv.decode(&results)){
ir_value=results.value;
Serial.println(ir_value,HEX);
iRrecv.resume();
}
}
作者:newcode 更多资源请关注纽扣编程微信公众号

从事机器人比赛、机器人等级考试、少儿scratch编程、信息学奥赛等研究学习

浙公网安备 33010602011771号