1#include<LiquidCrystal.h>
2#include <IRremote.h>
3
4int RECV_PIN = 6;
5IRrecv irrecv(RECV_PIN);
6decode_results results;
7LiquidCrystal lcd(11, 10, 5, 4, 3, 2);
8int i=0;
9
10byte Heart[] = {
11 B00000,
12 B01010,
13 B11111,
14 B11111,
15 B01110,
16 B00100,
17 B00000,
18 B00000};
19
20byte Z1[] = {
21 B01111,
22 B00001,
23 B00010,
24 B00100,
25 B01000,
26 B01111,
27 B00000,
28 B00000};
29
30byte Z2[] = {
31 B00000,
32 B00000,
33 B00000,
34 B00111,
35 B00001,
36 B00010,
37 B00100,
38 B00111};
39void setup() {
40 lcd.createChar(1, Heart);
41 lcd.createChar(2, Z1);
42 lcd.createChar(3, Z2);
43Serial.begin (9600);
44irrecv.enableIRIn();
45lcd.begin(16, 2);
46lcd.print("Starting System");
47delay(2000);
48lcd.clear();
49lcd.print("System on");
50delay(1000);
51lcd.clear();
52lcd.setCursor(0, 0);
53 lcd.print("Press Button");
54lcd.setCursor(0, 1);
55 lcd.print("To Get Value");
56
57
58}
59void loop(){
60 if (irrecv.decode(&results)){
61switch(results.value)
62 {
63 case 0xF720DF://1 Button
64 Serial.print("Button Pressed 1 Passing Text to LCD");
65 lcd.begin(16, 2);
66 lcd.print("Button Press 1");
67 lcd.setCursor(0, 1);
68 lcd.print("How Are You");
69break;
70
71
72 case 0xF7A05F://2 Button
73 Serial.print("Button Pressed 2 Passing Text to LCD");
74 lcd.begin(16, 2);
75 lcd.print("Button Press 2");
76 lcd.setCursor(0, 1);
77 lcd.print("What to Do?");
78break;
79
80 case 0xF7609F://3 Button
81 Serial.print("Button Pressed 3 Passing Text to LCD");
82 lcd.begin(16, 2);
83 lcd.print("Button Press 3");
84 lcd.setCursor(0, 1);
85 lcd.print("Good Morning");
86break;
87
88case 0xF7E01F://4 Button
89 Serial.print("Button Pressed 4 Passing Text to LCD");
90 lcd.begin(16, 2);
91 lcd.print("Button Press 4");
92 lcd.setCursor(0, 1);
93 lcd.print("Good Afternon");
94break;
95
96case 0xF710EF://5 Button
97 Serial.print("Button Pressed 5 Passing Text to LCD");
98 lcd.begin(16, 2);
99 lcd.print("Button Press 5");
100 lcd.setCursor(0, 1);
101 lcd.print("Custom Icon");
102break;
103
104
105case 0xF7906f://6 Button
106 Serial.print("Button Pressed 6 Passing Text to LCD");
107 lcd.begin(16, 2);
108 lcd.print(" I ");
109 lcd.write(1);
110 lcd.print(" ARDUINO");
111 lcd.setCursor(0,1);
112 lcd.print(" I sleep ");
113 lcd.write(2);
114 lcd.write(3);
115 break;
116
117
118 case 0xF7D028://5 Button
119 Serial.print("Button Pressed 6 Passing Text to LCD");
120 lcd.begin(16, 2);
121 lcd.print("Button Press 6");
122 lcd.setCursor(0, 1);
123 lcd.print("Good Night");
124break;
125
126
127case 0xF750AF://7 Button
128 Serial.print("Button Pressed 7 Passing Text to LCD");
129 lcd.begin(16, 2);
130 lcd.print("Button Press 7");
131 lcd.setCursor(0, 1);
132 lcd.print("Animate Text");
133break;
134
135case 0xF7D02F://8 Button
136 Serial.print("BLinking");
137
138 lcd.begin(16, 2);
139
140 lcd.print("BLinking");
141 lcd.setCursor(0, 1);
142 lcd.print(" Text ");
143 lcd.noBlink();
144 delay(2000);
145 lcd.blink();
146 delay(2000);
147
148case 0xF730CF://9 Button
149 Serial.print("Scroll");
150
151 lcd.setCursor(15,0);
152 lcd.print("I LOVE");
153 delay(500);
154 for(i=0;i<20;i++)
155 {
156 lcd.scrollDisplayLeft();
157 delay(150);
158 }
159 lcd.clear();
160 lcd.setCursor(15,0);
161 lcd.print("ARDUINO");
162 delay(500);
163 for(i=0;i<22;i++)
164 {
165 lcd.scrollDisplayLeft();
166 delay(150);
167 }
168 lcd.clear();
169
170
171break;
172 default:
173Serial.print("Undefined code received: 0x");
174Serial.println(results.value, HEX);
175lcd.begin(16, 2);
176 lcd.print("Undefined Button");
177 lcd.setCursor(0, 1);
178 lcd.print(results.value, HEX);
179 break;
180}
181irrecv.resume();
182}
183}
184