File tree Expand file tree Collapse file tree 8 files changed +711
-0
lines changed Expand file tree Collapse file tree 8 files changed +711
-0
lines changed Original file line number Diff line number Diff line change 1+ ## DIYables IR Remote Controller Library for Arduino - DIYables_IRcontroller
2+ This library is designed for Arduino, ESP32, ESP8266... to received the controlled key from the DIYables IR Remote Controller.
3+
4+
5+ ![ DIYables IR Remote Controller Module] ( https://diyables.io/images/products/infrared-ir-remote-control-kits-with-controller-and-receiver-1.jpg )
6+
7+
8+ Product Link
9+ ----------------------------
10+ * [ DIYables 17-key IR Remote Controller] ( https://diyables.io/products/infrared-ir-remote-control-kit-with-17-key-controller-and-receiver )
11+ * [ DIYables 21-key IR Remote Controller] ( https://diyables.io/products/infrared-ir-remote-control-kit-with-21-key-controller-and-receiver )
12+
13+
14+ Features
15+ ----------------------------
16+ * Easy to use
17+ * Configurable debouce time for key press
18+
19+
20+ Available Functions
21+ ----------------------------
22+ * DIYables_IRcontroller_17(int pin, int debounceTime);
23+ * DIYables_IRcontroller_21(int pin, int debounceTime);
24+ * void begin();
25+ * Key17 getKey();
26+ * Key21 getKey();
27+
28+ Return from DIYables_IRcontroller_17::getKey()
29+ * Key17::NONE
30+ * Key17::KEY_1
31+ * Key17::KEY_2
32+ * Key17::KEY_3
33+ * Key17::KEY_4
34+ * Key17::KEY_5
35+ * Key17::KEY_6
36+ * Key17::KEY_7
37+ * Key17::KEY_8
38+ * Key17::KEY_9
39+ * Key17::KEY_STAR
40+ * Key17::KEY_0
41+ * Key17::KEY_SHARP
42+ * Key17::KEY_UP
43+ * Key17::KEY_LEFT
44+ * Key17::KEY_OK
45+ * Key17::KEY_RIGHT
46+ * Key17::KEY_DOWN
47+ * Key17::UNKNOWN
48+
49+ Return from DIYables_IRcontroller_21::getKey()
50+ * Key21::NONE
51+ * Key21::KEY_CH_MINUS
52+ * Key21::KEY_CH
53+ * Key21::KEY_CH_PLUS
54+ * Key21::KEY_PREV
55+ * Key21::KEY_NEXT
56+ * Key21::KEY_PLAY_PAUSE
57+ * Key21::KEY_VOL_MINUS
58+ * Key21::KEY_VOL_PLUS
59+ * Key21::KEY_EQ
60+ * Key21::KEY_100_PLUS
61+ * Key21::KEY_200_PLUS
62+ * Key21::KEY_0
63+ * Key21::KEY_1
64+ * Key21::KEY_2
65+ * Key21::KEY_3
66+ * Key21::KEY_4
67+ * Key21::KEY_5
68+ * Key21::KEY_6
69+ * Key21::KEY_7
70+ * Key21::KEY_8
71+ * Key21::KEY_9
72+ * Key21::UNKNOWN
73+
74+
75+
76+
77+
78+ Available Examples
79+ ----------------------------
80+ * IRcontroller_17
81+ * IRcontroller_21
82+
83+
84+
85+ References
86+ ----------------------------
87+ * [ DIYables_IRcontroller Library Reference] ( https://arduinogetstarted.com/reference/library/diyables-ir-controller-library )
88+
89+
90+ Tutorials
91+ ----------------------------
92+ * [ Arduino - DIYables IR Remote Controller] ( https://arduinogetstarted.com/tutorials/arduino-ir-remote-control )
93+ * [ ESP32 - DIYables IR Remote Controller] ( https://esp32io.com/tutorials/esp32-ir-remote-control )
94+ * [ ESP8266 - DIYables IR Remote Controller] ( https://newbiely.com/tutorials/esp8266/esp8266-ir-remote-control )
95+
Original file line number Diff line number Diff line change 1+ /*
2+ Created by DIYables
3+
4+ This example code is in the public domain
5+
6+ Product page: https://diyables.io/products/infrared-ir-remote-control-kit-with-17-key-controller-and-receiver
7+ */
8+
9+ #include < DIYables_IRcontroller.h> // DIYables_IRcontroller library
10+ #define IR_RECEIVER_PIN 7 // The Arduino pin connected to IR controller
11+
12+ DIYables_IRcontroller_17 irController (IR_RECEIVER_PIN, 200 ); // debounce time is 200ms
13+
14+ void setup () {
15+ Serial.begin (9600 );
16+ irController.begin ();
17+ }
18+
19+ void loop () {
20+ Key17 command = irController.getKey ();
21+ if (command != Key17::NONE) {
22+ switch (command) {
23+ case Key17::KEY_1:
24+ Serial.println (" 1" );
25+ // TODO: YOUR CONTROL
26+ break ;
27+
28+ case Key17::KEY_2:
29+ Serial.println (" 2" );
30+ // TODO: YOUR CONTROL
31+ break ;
32+
33+ case Key17::KEY_3:
34+ Serial.println (" 3" );
35+ // TODO: YOUR CONTROL
36+ break ;
37+
38+ case Key17::KEY_4:
39+ Serial.println (" 4" );
40+ // TODO: YOUR CONTROL
41+ break ;
42+
43+ case Key17::KEY_5:
44+ Serial.println (" 5" );
45+ // TODO: YOUR CONTROL
46+ break ;
47+
48+ case Key17::KEY_6:
49+ Serial.println (" 6" );
50+ // TODO: YOUR CONTROL
51+ break ;
52+
53+ case Key17::KEY_7:
54+ Serial.println (" 7" );
55+ // TODO: YOUR CONTROL
56+ break ;
57+
58+ case Key17::KEY_8:
59+ Serial.println (" 8" );
60+ // TODO: YOUR CONTROL
61+ break ;
62+
63+ case Key17::KEY_9:
64+ Serial.println (" 9" );
65+ // TODO: YOUR CONTROL
66+ break ;
67+
68+ case Key17::KEY_STAR:
69+ Serial.println (" *" );
70+ // TODO: YOUR CONTROL
71+ break ;
72+
73+ case Key17::KEY_0:
74+ Serial.println (" 0" );
75+ // TODO: YOUR CONTROL
76+ break ;
77+
78+ case Key17::KEY_SHARP:
79+ Serial.println (" #" );
80+ // TODO: YOUR CONTROL
81+ break ;
82+
83+ case Key17::KEY_UP:
84+ Serial.println (" UP" );
85+ // TODO: YOUR CONTROL
86+ break ;
87+
88+ case Key17::KEY_DOWN:
89+ Serial.println (" DOWN" );
90+ // TODO: YOUR CONTROL
91+ break ;
92+
93+ case Key17::KEY_LEFT:
94+ Serial.println (" LEFT" );
95+ // TODO: YOUR CONTROL
96+ break ;
97+
98+ case Key17::KEY_RIGHT:
99+ Serial.println (" RIGHT" );
100+ // TODO: YOUR CONTROL
101+ break ;
102+
103+ case Key17::KEY_OK :
104+ Serial.println (" OK" );
105+ // TODO: YOUR CONTROL
106+ break ;
107+
108+ default :
109+ Serial.println (" WARNING: undefined command:" );
110+ break ;
111+ }
112+ }
113+ }
Original file line number Diff line number Diff line change 1+ /*
2+ Created by DIYables
3+
4+ This example code is in the public domain
5+
6+ Product page: https://diyables.io/products/infrared-ir-remote-control-kit-with-21-key-controller-and-receiver
7+ */
8+
9+ #include < DIYables_IRcontroller.h> // DIYables_IRcontroller library
10+ #define IR_RECEIVER_PIN 7 // The Arduino pin connected to IR controller
11+
12+ DIYables_IRcontroller_21 irController (IR_RECEIVER_PIN, 200 ); // debounce time is 200ms
13+
14+ void setup () {
15+ Serial.begin (9600 );
16+ irController.begin ();
17+ }
18+
19+ void loop () {
20+ Key21 command = irController.getKey ();
21+ if (command != Key21::NONE) {
22+ switch (command) {
23+ case Key21::KEY_CH_MINUS:
24+ Serial.println (" CH-" );
25+ // TODO: YOUR CONTROL
26+ break ;
27+
28+ case Key21::KEY_CH:
29+ Serial.println (" CH" );
30+ // TODO: YOUR CONTROL
31+ break ;
32+
33+ case Key21::KEY_CH_PLUS:
34+ Serial.println (" CH+" );
35+ // TODO: YOUR CONTROL
36+ break ;
37+
38+ case Key21::KEY_PREV:
39+ Serial.println (" <<" );
40+ // TODO: YOUR CONTROL
41+ break ;
42+
43+ case Key21::KEY_NEXT:
44+ Serial.println (" >>" );
45+ // TODO: YOUR CONTROL
46+ break ;
47+
48+ case Key21::KEY_PLAY_PAUSE:
49+ Serial.println (" >||" );
50+ // TODO: YOUR CONTROL
51+ break ;
52+
53+ case Key21::KEY_VOL_MINUS:
54+ Serial.println (" –" );
55+ // TODO: YOUR CONTROL
56+ break ;
57+
58+ case Key21::KEY_VOL_PLUS:
59+ Serial.println (" +" );
60+ // TODO: YOUR CONTROL
61+ break ;
62+
63+ case Key21::KEY_EQ:
64+ Serial.println (" EQ" );
65+ // TODO: YOUR CONTROL
66+ break ;
67+
68+ case Key21::KEY_100_PLUS:
69+ Serial.println (" 100+" );
70+ // TODO: YOUR CONTROL
71+ break ;
72+
73+ case Key21::KEY_200_PLUS:
74+ Serial.println (" 200+" );
75+ // TODO: YOUR CONTROL
76+ break ;
77+
78+ case Key21::KEY_0:
79+ Serial.println (" 0" );
80+ // TODO: YOUR CONTROL
81+ break ;
82+
83+ case Key21::KEY_1:
84+ Serial.println (" 1" );
85+ // TODO: YOUR CONTROL
86+ break ;
87+
88+ case Key21::KEY_2:
89+ Serial.println (" 2" );
90+ // TODO: YOUR CONTROL
91+ break ;
92+
93+ case Key21::KEY_3:
94+ Serial.println (" 3" );
95+ // TODO: YOUR CONTROL
96+ break ;
97+
98+ case Key21::KEY_4:
99+ Serial.println (" 4" );
100+ // TODO: YOUR CONTROL
101+ break ;
102+
103+ case Key21::KEY_5:
104+ Serial.println (" 5" );
105+ // TODO: YOUR CONTROL
106+ break ;
107+
108+ case Key21::KEY_6:
109+ Serial.println (" 6" );
110+ // TODO: YOUR CONTROL
111+ break ;
112+
113+ case Key21::KEY_7:
114+ Serial.println (" 7" );
115+ // TODO: YOUR CONTROL
116+ break ;
117+
118+ case Key21::KEY_8:
119+ Serial.println (" 8" );
120+ // TODO: YOUR CONTROL
121+ break ;
122+
123+ case Key21::KEY_9:
124+ Serial.println (" 9" );
125+ // TODO: YOUR CONTROL
126+ break ;
127+
128+ default :
129+ Serial.println (" WARNING: undefined command:" );
130+ break ;
131+ }
132+ }
133+ }
You can’t perform that action at this time.
0 commit comments