用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库文件
浙公网安备 33010602011771号