Hi guys,
I have been searching the forum for someone who is sending his own code with the IRremote Library. I have yet to find someone.
Here is my problem with all the other projects:
They want to use a remote to control stuff, i just want to send data over it.
Let me explain: I have a couple of trains which run on a track. I want to know where they are and who they are. My thoughts where to let the train send something like: "TR035" (TR for train and 035 for train nr. 35) via an IR transmitter. The receivers would be placed on the track and send the data to a 'master' which then creates a map. But for now I’m trying to get the IR communication to work.
I bought some IR transmitters and receivers and used the IRremote library to test the connection. When use the IRrecord example on 2 arduino’s and hook up the components as described in the comments, I can use my Samsung remote to read a raw signal and then repeat this signal with the push button. This works as it should.
Proof:
Serial data from COM3:
Received unknown code, saving as raw
m4350 s4500 m450 s1750 m500 s1750 m500 s1700 m500 s600 m450 s650 m500 s600 m500 s600 m500 s600 m500 s1700 m500 s1700 m500 s1750 m500 s600 m450 s650 m450 s600 m500 s600 m500 s600 m500 s1750 m450 s1750 m450 s650 m450 s1750 m450 s650 m450 s650 m450 s650 m450 s650 m450 s650 m400 s700 m400 s1800 m450 s650 m450 s1750 m450 s1800 m400 s1800 m450 s1750 m450
Received unknown code, saving as raw
m4300 s4550 m400 s1800 m450 s1750 m450 s1800 m400 s700 m400 s700 m400 s700 m400 s650 m450 s650 m450 s1800 m400 s1800 m450 s1750 m450 s650 m450 s650 m450 s650 m450 s650 m450 s650 m450 s1750 m450 s1800 m400 s650 m450 s1800 m450 s650 m400 s700 m400 s700 m400 s650 m500 s600 m450 s650 m500 s1750 m400 s700 m400 s1800 m450 s1750 m450 s1800 m400 s1800 m450
Pressed, sending
Sent raw
Released
Pressed, sending
Sent raw
Pressed, sending
Sent raw
Released
Pressed, sending
Serial data from COM4
Received unknown code, saving as raw
m4250 s4650 m300 s1900 m400 s1750 m350 s1950 m300 s800 m300 s800 m350 s750 m350 s700 m350 s750 m350 s1900 m300 s1900 m350 s1850 m400 s700 m300 s750 m400 s750 m350 s750 m350 s750 m300 s1850 m400 s1850 m350 s700 m400 s1900 m350 s700 m350 s750 m350 s800 m300 s700 m450 s700 m350 s700 m450 s1800 m350 s750 m350 s1850 m400 s1800 m400 s1850 m350 s1850 m400
Received unknown code, saving as raw
m4200 s4650 m350 s1900 m400 s1800 m400 s1800 m350 s800 m300 s800 m350 s750 m250 s800 m350 s750 m350 s1900 m300 s1900 m350 s1850 m350 s700 m400 s700 m400 s750 m350 s700 m400 s700 m400 s1850 m350 s1850 m350 s750 m350 s1850 m400 s700 m300 s800 m400 s700 m350 s700 m400 s750 m350 s700 m500 s1750 m350 s750 m350 s1850 m350 s1850 m400 s1850 m300 s1900 m350
Received unknown code, saving as raw
m4200 s4650 m350 s1900 m350 s1850 m350 s1900 m250 s850 m350 s750 m250 s850 m350 s700 m350 s750 m350 s1900 m350 s1850 m300 s1900 m300 s800 m350 s750 m350 s750 m350 s750 m300 s800 m400 s1800 m350 s1900 m350 s700 m350 s1900 m300 s800 m250 s850 m250 s850 m250 s800 m400 s700 m350 s700 m400 s1900 m300 s800 m300 s1850 m350 s1850 m450 s1800 m300 s1900 m400
Received unknown code, saving as raw
m4200 s4700 m300 s1900 m350 s1850 m350 s1900 m350 s750 m250 s850 m250 s850 m350 s700 m350 s750 m300 s1950 m350 s1850 m350 s1850 m400 s700 m350 s750 m350 s750 m300 s800 m350 s750 m350 s1800 m350 s1900 m350 s700 m400 s1900 m300 s750 m350 s750 m350 s800 m250 s750 m400 s750 m350 s700 m400 s1850 m350 s750 m300 s1900 m400 s1800 m400 s1850 m350 s1850 m300
Received unknown code, saving as raw
m4150 s4700 m300 s1900 m400 s1800 m350 s1900 m350 s750 m350 s800 m300 s750 m350 s700 m400 s750 m300 s1900 m350 s1900 m350 s1800 m400 s700 m350 s750 m350 s750 m350 s750 m400 s700 m400 s1800 m400 s1850 m350 s700 m400 s1850 m350 s750 m350 s750 m300 s800 m250 s800 m400 s700 m400 s700 m350 s1900 m350 s750 m350 s1850 m300 s1900 m400 s1850 m300 s1900 m300
Then I went on to the IRsendDemo and altered it a bit to send raw codes like in the IRrecord:
#include <IRremote.h>
IRsend irsend;
unsigned int rawCode[1]={025}; //The code to transmit
int codeLen; // The length of the code
void setup()
{
Serial.begin(9600);
}
void loop() {
if (Serial.read() != -1) {
codeLen = sizeof(rawCode);
for (int i = 0; i < 3; i++) {
Serial.print("Length: ");
Serial.println(codeLen);
irsend.sendRaw(rawCode, codeLen, 38);
Serial.println("Sent");
delay(40);
}
}
}
The receiving end stays blank, the sending end displays:
Length: 2
Sent
Length: 2
Sent
Length: 2
Sent
Length: 2
Sent
Length: 2
Sent
Length: 2
Sent
Does anyone have an idea of what I’m doing wrong?
Thanks in advance,
Kind regards,
Da_Beast