-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPanasonicRotelRemote.ino
More file actions
106 lines (90 loc) · 2 KB
/
PanasonicRotelRemote.ino
File metadata and controls
106 lines (90 loc) · 2 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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
/*
* Control Rotel Amp with Panasonic TV Remote
* Panasonic FXW784 - Rotel RA-12
*/
#include <IRremote.h>
#include "PanasonicIrCodes.h"
#define MODELED 13
int RECV_PIN = 8;
IRrecv irrecv(RECV_PIN);
decode_results results;
void setup()
{
Serial.begin(115200,SERIAL_8N1);
irrecv.enableIRIn();
}
boolean muted=false;
void mute() {
muted=true;
Serial.print("mute_on!");
}
void volup() {
if (muted) Serial.print("mute_off!");
muted=false;
Serial.print("volume_up!");
}
boolean amprunning=false;
void ampon()
{
if (amprunning) return;
Serial.print("power_on!");
amprunning=true;
}
void ampoff()
{
if (!amprunning) return;
Serial.print("power_off!");
amprunning=false;
}
boolean amp_mode=false;
boolean attention_mode=false;
void amp_mode_on()
{
amp_mode=true;
digitalWrite(MODELED,HIGH);
}
void amp_mode_off()
{
amp_mode=false;
digitalWrite(MODELED,LOW);
}
void loop() {
unsigned long code;
if (irrecv.decode(&results))
{
if (results.decode_type == PANASONIC)
{
code=results.value;
if (code==PanasonicVOLPLUS) { ampon(); volup(); }
if (code==PanasonicVOLMINUS) Serial.print("volume_down!");
if (code==PanasonicMUTE) mute();
if (code==PanasonicPOWER) ampoff();
if (code==PanasonicPRGPLUS) ampon();
if (code==PanasonicDIGIT1) ampon();
if (amp_mode)
{
if (code==PanasonicRED) { Serial.print("aux2!"); }
else if (code==PanasonicGREEN) { Serial.print("opt1!"); }
else if (code==PanasonicYELLOW) { Serial.print("opt2!"); }
else if (code==PanasonicBLUE) { Serial.print("coax1!"); }
else amp_mode_off();
}
else if (code==PanasonicGREEN) // press green twice for mode switch
{
if (attention_mode)
{
amp_mode_on();
attention_mode=false;
}
else
{
delay(100);
attention_mode=true;
}
}
else attention_mode=false;
}
delay(100);
irrecv.resume();
}
}