Repository navigation
Expand file tree
/
Copy pathirremote_send.ino
More file actions
71 lines (52 loc) · 1.48 KB
/
Copy pathirremote_send.ino
File metadata and controls
71 lines (52 loc) · 1.48 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#include <IRremote.h>
int RECV_PIN = 12;
IRrecv irrecv(RECV_PIN);
decode_results results;
IRsend irsend;
int botaoLiga = 4;
int botaoDesligar = 5;
int botaoGreen = 6;
int botaoBlue = 7;
int botaoRed = 8;
void setup()
{
Serial.begin(9600);
digitalWrite(botaoLiga, INPUT_PULLUP);
digitalWrite(botaoDesligar, INPUT_PULLUP);
digitalWrite(botaoBlue , INPUT_PULLUP);
digitalWrite(botaoGreen, INPUT_PULLUP);
digitalWrite(botaoRed , INPUT_PULLUP);
//irrecv.enableIRIn();
}
void loop() {
if(digitalRead(botaoLiga) == LOW){
irsend.sendNEC(0xF7C03F, 32);
irsend.sendNEC(0xFFE01F, 32);
Serial.println("Ligar");
}
if(digitalRead(botaoDesligar) == LOW){
irsend.sendNEC(0xF740BF, 32);
irsend.sendNEC(0xFF609F, 32);
Serial.println("Desligar");
}
if(digitalRead(botaoGreen) == LOW){
irsend.sendNEC(0xF7A05F, 32);
irsend.sendNEC(0xFF10EF, 32);
Serial.println("Troca para Verde");
}
if(digitalRead(botaoBlue) == LOW){
irsend.sendNEC(0xF7609F, 32);
irsend.sendNEC(0xFF50AF, 32);
Serial.println("Troca para azul");
}
if(digitalRead(botaoRed) == LOW){
irsend.sendNEC(0xF720DF, 32);
irsend.sendNEC(0xFF906F, 32);
Serial.println("Troca para vermelho");
}
if (irrecv.decode(&results)) {
Serial.println(results.value, HEX);
Serial.println(results.decode_type);
irrecv.resume();
}
}