Hi
I started a project with Arduino and Node.js. It's a multiple choice quiz to be used in the classroom. Each student team has a IR remote control. The questions are displayed on the screen (as a webpage) and the correct answer is chosen by pressing buttons 1,2 or 3 on each remote. Arduino receives the codes and passes them to node.js. I have 6 IR remotes (all different to each-other) most of them from unused electronic equipment (TV, VCR, CD-Players etc).
Everything works pretty well but there are some problems in case the remotes are misused! For example if a user keeps pressing a button (instead of releasing it immediately) he will block all other users from giving their answers. As a result the other users will do the same (as soon as they don't see their answer being accepted) and everything will be a mess.
I don't know if it's possible to hack the remotes to send a single code if a button is pressed (even if it's pressed continuously) and i don't have the skills to do it anyway. So I'm looking for a way to block all these unwanted codes arriving to the receiver.
My code is very simple. I tried a short delay before the next read, but it didn't help.
Any ideas please?
#include <IRremote.h>
int IRpin = 11;
IRrecv irrecv(IRpin);
decode_results results;
void setup()
{
Serial.begin(9600);
irrecv.enableIRIn(); // Start the receiver
}
void loop()
{
if (irrecv.decode(&results)){
if (!checkResults(results.value)) {
delay(500);
irrecv.resume(); // Receive the next value
}else
{
Serial.println(results.value, HEX);
irrecv.blink13(true);
irrecv.resume(); // Receive the next value
}
}
}
bool checkResults(long res){
if (res == 0x10EFD02F || res == 0x10EF827D || res == 0x10EF926D || res == 0x10EF9A65 || res == 0xA90 || res == 0x10 || res == 0x810 || res == 0x410 || res == 0x8087887 || res == 0x808827D || res == 0x80842BD
|| res == 0x808C23D || res == 0x10C8E11E || res == 0x10C8C13E || res == 0x10C846B9 || res == 0x10C8817E || res == 0x23104BB || res == 0x796B1B27 || res == 0xBDFC90D7 || res == 0x5E76F1FB)
return true;
else
return false;
}