首页 > 其他 > 详细

6红外遥控程序

时间:2019-06-25 16:28:25      阅读:92      评论:0      收藏:0      [点我收藏+]
#include <IRremote.h>
int RECV_PIN = 11;
int LED_PIN = 2;
IRrecv irrecv(RECV_PIN);

decode_results results;

void setup()
{
  Serial.begin(9600);
  irrecv.enableIRIn(); // Start the receiver
  pinMode(LED_PIN, OUTPUT);
  digitalWrite(LED_PIN, HIGH);
}

void loop() {
  if (irrecv.decode(&results)) {
    Serial.println(results.value, HEX);
  
    
    if (results.value == 0xFFA25D) //开灯的值
    {
      digitalWrite(LED_PIN, LOW);
    } else if (results.value == 0xFF629D) //关灯的值
    {
      digitalWrite(LED_PIN, HIGH);
    }
    irrecv.resume(); // Receive the next value
  }
  delay(100);
}

红外接收器

6红外遥控程序

原文:https://www.cnblogs.com/Sonny-xby/p/11083480.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!