I am trying to make an arduino Uno and Mega communicate with each other over IR, but I am having trouble decrypting the output.
Uno code:
#include <IRremote.h>
IRsend irsend;
void setup() {
// put your setup code here, to run once:
}
void loop() {
// put your main code here, to run repeatedly:
for(int i = 0; i < 200; i++){
irsend.sendRC5(i, 3);
delay(500);
}
}
Mega code:
#include <IRremote.h>
#define RECV_PIN 3
IRrecv irrecv(RECV_PIN);
decode_results results;
void setup() {
Serial.begin(9600);
irrecv.enableIRIn();
}
void loop() {
if (irrecv.decode(&results)){
int state;
if ( results.value == 1 ){
state = HIGH;
}
else{
state = LOW;
}
Serial.println(results.value, DEC);
irrecv.resume();
}
}
Serial output:
08:59:57.562 -> 819043197
08:59:58.072 -> 4239130558
08:59:58.586 -> 4092259158
08:59:59.094 -> 1271936904
08:59:59.604 -> 1322269761
09:00:00.119 -> 3687369585
09:00:00.625 -> 1513342804
09:00:01.136 -> 869376052
09:00:01.648 -> 819043197
09:00:02.157 -> 4239130558
09:00:02.669 -> 4092259158
09:00:03.180 -> 1271936904
09:00:03.691 -> 1322269761
Is there some kind of decrypt function, or do I have to map each output manually, for 500 outputs? I have joysticks that can return any value in that range.
I had a bad library, updating it fixed the problem