I have a Marantz Amplifier connected to a Rotel CD-Player. All I want is to change the volume, Play/Pause and skip tracks.
Therefore I made a sketch to read the codes from the remotes-it worked. The codes I got are in a number only format like :12154801.
Al I want now is a very simple sketch like:
if button X == High send code X
Seems very simple.
But I tried at least 20 different sketches-none worked.
I simply don´t get the IRsend command, which one is the wright on, wich one to use for this type of code and so on.
The IR Led is working proberly, I checked it with one sketch.
Could please someone be so kind to help me with that problem an write me the few lines from including the library till sending the code with the prober command?
This is the code to read the IR signals from the remote:
#include <IRremote.h> // Einbinden der Bibliothek
int RECV_PIN = 11; // Digitales Signal von Pin 11 abgreifen
IRrecv irrecv(RECV_PIN); // Bibliothek den Eingangs Pin mitteilen
decode_results results; // Die Ergebnisse decodieren
void setup()
{
Serial.begin(9600); // Serielle Verbindung aktivieren
pinMode (13, OUTPUT); // Pin 13 (LED) als Ausgang festlegen
irrecv.enableIRIn(); // Eingang auf Pin 11 aktivieren
}
void loop() {
if (irrecv.decode(&results)) { // Wenn die IR Bibliothek ein decodiertes Signal liefert ...
Serial.println(results.value, DEC); // ... dann soll dieses auf der Seriellen Schnittstelle ausgegeben werden
delay(000);
irrecv.resume(); // neue Messung durchführen
}
}
These are the codes and all functions I will need:
Marantz pm5005
Volume up : 3088
1040
Volume down : 3089
1041
ON/OFF : 1036
3084
ROTEL CD
PLAY: 3242772535
PAUSE: 3242774575
Next track: 3242743975
Last track: 3242750095
Here is one of the sketches I tried so far:
#include <IRremote.h>
#include <IRremoteInt.h>
const int buttonPin = 4;
const int ledPin = 12;
const int pinSendIR = 11;
int buttonState = 0;
IRsend irsend;
void setup() {
pinMode(ledPin, OUTPUT);
pinMode(buttonPin, INPUT);
}
void loop(){
buttonState = digitalRead(buttonPin);
if (buttonState == HIGH) {
digitalWrite(ledPin, HIGH);
}
else {
digitalWrite(ledPin, LOW);
}
if (buttonState == HIGH) {
irsend.sendRaw(3242772535,2,28); //Note the approach used to automatically calculate the size of the array.
}
}
if I use for example sendSony with an code from sketches I found on the web I can see the IR Led working with my digicam.
But I have absolutly no idea how the get it to work with my kind of code.
SendRaw needs an array of pulse length values, not a single number. You can't use just the '.value' part of the decoded message without knowing the message format. For PANASONIC format messages you need the device address in addition to the data value.
Use the IRrecvDumpV2 example to show the FULL results of the decode. Show us the results and we can advise further.
So this is the sketch I´ve used to record the signals :
#include <IRremote.h> // Einbinden der Bibliothek
int RECV_PIN = 11; // Digitales Signal von Pin 11 abgreifen
IRrecv irrecv(RECV_PIN); // Bibliothek den Eingangs Pin mitteilen
decode_results results; // Die Ergebnisse decodieren
void setup()
{
Serial.begin(9600); // Serielle Verbindung aktivieren
pinMode (13, OUTPUT); // Pin 13 (LED) als Ausgang festlegen
irrecv.enableIRIn(); // Eingang auf Pin 11 aktivieren
}
void loop() {
if (irrecv.decode(&results)) { // Wenn die IR Bibliothek ein decodiertes Signal liefert ...
Serial.println(results.value, DEC); // ... dann soll dieses auf der Seriellen Schnittstelle ausgegeben werden
delay(000);
irrecv.resume(); // neue Messung durchführen
datoni:
So this is the sketch I´ve used to record the signals :
That is the same sketch you showed before. It only shows you result.value which is NOT ENOUGH to play back the code.
To play back the code you need:
result.decode_type
result.value
result.bits
If decode_type is PANASONIC or SHARP you also need result.address
If decode_type is UNKNOWN you need result.rawbuf and result.rawlen and those only work if result.overflow == false