Robin2:
I don't see how this works in either versionif(ircode == 2231601134)Earlier you have
ircode = ir.read() ;so as far as I can see IRcode will never hold anything except a single byte
First im gona say that what you noticed its not the problem, coz this is ircode = ir.read() ; where i get information from my IReciver , then i have if(ircode == 2231601134) this code to make only one correct key from IRemote.
If recived code is 2231601134 my lcd will print access granted , else access denied. Do you under stand?
Here is code without LCD
#include <NECIRrcv.h>
#define IRPIN 7
NECIRrcv ir(IRPIN) ;
#define BUZZER 8
void setup() {
pinMode(8, OUTPUT);
ir.begin() ;
}
void loop()
{ unsigned long ircode ;
while (ir.available()) {
ircode = ir.read() ;
Serial.print("got code: 0x") ;
Serial.println(ircode, HEX);
if (ircode == 2231601134)
{ buzzer();
delay(100);
}
else
{ alarm();
delay(100);
}
}
}
void buzzer() {
tone(8, 1500);
delay(300);
noTone(8);
delay(100);
}
void alarm() {
tone(8, 1500);
delay(500);
tone(8, 1500);
delay(500);
noTone (8);
delay(100);
}