思齐

实现米思齐按键控制LED

一曲冷凌霜 提交于 2019-12-02 09:05:03
实现米思齐按键控制LED 代码实现如下: #include <IRremote.h> IRrecv irrecv_10(10); decode_results results_10; long ir_value; volatile int led; volatile boolean ledstate; void setup(){ Serial.begin(9600); irrecv_10.enableIRIn(); led = 0; ledstate = 0; } void loop(){ if (irrecv_10.decode(&results_10)) { ir_value=results_10.value; String type="UNKNOWN"; String typelist[14]={"UNKNOWN", "NEC", "SONY", "RC5", "RC6", "DISH", "SHARP", "PANASONIC", "JVC", "SANYO", "MITSUBISHI", "SAMSUNG", "LG", "WHYNTER"}; if(results_10.decode_type>=1&&results_10.decode_type<=13){ type=typelist[results_10.decode_type]; } Serial.print(