Blogger

Delete comment from: Ken Shirriff's blog

Anonymous said...

Hi Ken,
Thanks for the IRremote codes!. Saving lifes here. Im trying to use a remote to scroll up and down on my pc while I exercise but I dont want to keep pressing it. It just serials out FFFFFFFF until I hit another button. Must be the NEC coding thing you were talking about. My question is how do I fix this with coding. Is there a way to see what the "last" code if the serial sees a bunch of FFFFFF and differential from the up/down presses? Here is my code:

#include
int RECV_PIN = A2;
IRrecv irrecv(RECV_PIN);
decode_results results;
int count = 0;
void setup()
{
Serial.begin(9600);
irrecv.enableIRIn(); // Start the receiver
}
void loop() {
if (irrecv.decode(&results)) {
Serial.println(results.value,HEX);
Serial.println(count);
if (results.value == 1086263535) { ////UP ARROW
Mouse.scroll(2);
count++;
irrecv.resume(); // Receive the next value
}
else if (results.value == 1086259455) { ////DOWN ARROW
Mouse.scroll(-2);
irrecv.resume();
count++;
}
else if (results.value == 1086320655) { ////1
Keyboard.print(0);
irrecv.resume();
}
else if (results.value == 1086264045) { ////2
Keyboard.print(1);
irrecv.resume();
}
else if (results.value == 1086296175) { ////3
Keyboard.print(2);
irrecv.resume();
}
// Receive the next value
else {irrecv.resume();}
}
}

Jan 2, 2013, 7:58:45 PM


Posted to A Multi-Protocol Infrared Remote Library for the Arduino

Google apps
Main menu