I have been attempting to develop a IR receiver program, to receive the raw data from a KEYES VS1838B IR Receiver. There seems to be a failure in the length of the ON compared to the OFF. The IR SIGNAL is Custom, with a pulse width of 50%, and toggling on for 64 microseconds, then off for another 64 microseconds, and this repeats 25 times at a carrier of 38000hz.
Here is the received data.
000000000000000000000000000000000000000000(42)
111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111(351)
00000000000000000000000000000000000000000(41)
1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111(352)
0000000000000000000000000000000000000000(40)
111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111(396)
0000000000000000000000000000000000000000(40)
111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111(424)
000000000000000000000000000000000000000(39)
111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111(360)
000000000000000000000000000000000000000(39)
2124 captured
Here is a second attempt, with exactly the same IR CODE
000000000000000000000000000000000000000(39)
1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111(283)
00000000000000000000000000000000000000(38)
111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111(312)
000000000000000000000000000000000000(36)
11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111(272)
0000000000000000000000000000000000(34)
111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111(279)
0000000000000000000000000000000000(34)
1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111(277)
000000000000000000000000000000000(33)
1637 captured
*Please note that the input is inverted, and that I cut the extra constant stream of OFFS (1) at the end of each sample out, to save room.
As you can see here, there is something horribly wrong. First of all, it does not match the first recording, and also the length of the ON (0) Does not even come close to matching the length of the OFF (1). Also the ON (0) seems to be slowly decreasing in duration, every time that I run the test.
Just to make Sure that my programming is correct, here is my code.
int goody = 0;
int point = 0;
void setup() {
Serial.begin(115200);
pinMode(5, INPUT);
pinMode(7, OUTPUT);
}
void loop() {
goody = digitalRead(5);
if(goody == 0){
point = 0;
while(point <= 8000){
Serial.print(digitalRead(5));
delayMicroseconds(1);
point = point + 1;
}
}
}
I am running it on an Arduino Mega 2560 R3.
Please give me suggestions if you have any, Thanks.