用Tinkercad學arduino之 紅外遙控器

項目地址:https://www.tinkercad.com/things/c4DoDLruMgp-lcd-remote-control

 

 

// include the library code:
#include <LiquidCrystal.h>
#include <IRremote.h>

// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(7, 8, 9, 10, 11, 12);
int RECV_PIN = 5;
IRrecv irrecv(RECV_PIN);
decode_results results;

void setup() {
  irrecv.enableIRIn();
  lcd.begin(16, 2);
}

void loop() {
  
    if (irrecv.decode(&results))
  {
    lcd.clear();
    long CC = results.value;
        lcd.setCursor(0, 0);
        lcd.print(results.value, HEX);
        lcd.setCursor(0, 1);
        lcd.print(results.value);
        delay(30);
      irrecv.resume(); // Receive the next value
    }
    
}

遙控器鍵值附表(arduino

遙控器字符鍵值
紅色按鈕 0xff00
VOL+ 0xfe01
FUNC/STOP 0xfd02
左2個三角 0xfb04
暫停鍵 0xfa05
右2個三角 0xf906
向下三角 0xf708
VOL- 0xf609
向上三角 0xf50a
0 0xf30c
EQ 0xf20d
ST/REPT 0xf10e
1 0xef10
2 0xee11
3 0xed12
4 0xeb14
5 0xea15
6 0xe916
7 0xe718
8 0xe619
9 0xe51a

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Arduino庫文件

IRremote庫文件

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章