hello everybody i'm a french people so excuse if i have got a bad English
my problem is that if i enter the right code it repeat infinitely "your welcome"
i try with if/else but doesn't work also and have the same problem
so guys if you can help me thanks you
marin
so first there his my code :
#include <SoftwareSerial.h>
SoftwareSerial RFID(4, 5);
#include "TM1650.h"
#include <Keypad.h>
char code [8] = {'2', '8', '1', '0', '1', '9', '9', '8'};
int data[14] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
int acceptedtag [14] = {2, 48, 66, 48, 48, 57, 48, 54, 68, 69, 55, 49, 49, 3};
int key1 = 0;
boolean key2 = true;
char key;
boolean key3 = true;
int key4 = 0;
TM1650 keyPad(2, 3);
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
RFID.begin(9600);
keyPad.begin();
Serial.println(F("ready"));
}
void loop() {
if (key3 == true) {
Serial.println(F("Si vous voulez utilisez votre rfid tag tapez A"));
Serial.println(F("ou si vous voulez utilisez votre mot de passe tapez B"));
key3 = false;
}
char key = keypadreader();
if (key == 'A') {
while ( key1 <= 14) {
if (key2 == true) {
Serial.println(F("passez votre tag rfid devant le lecteur rfid s'il vous plait."));
key2 = false;
}
if (RFID.available() > 0)
{
data[key1] = RFID.read();
if (data[key1] == acceptedtag[key1]) {
key4++;
}
key1++;
}
}
}
if (key == 'B') {
while (key1 <= 7) {
if (key2 == true) {
Serial.print(F("tapez votre code s'il vous plait: "));
key2 = false;
}
key = keypadreader();
if (key != NO_KEY) {
Serial.print(key);
if (key == code[key1]) {
Serial.println(code[key1]);
key4++;
Serial.println(key4);
}
key1++;
char key = 0;
delay(500);
}
}
//le reste ne fonctionne pas ?? ah si jusqu'au code aprés a vos risque et peril (0313) c'est bon tout fonctionne sauf le txt
// "your welcome" qui s'affiche sans s'arrêtter (0815)
}
if ((key1 == 15) || (key1 == 8)) {
switch (key4) {
case 14: Serial.println(F("your welcome")); break;
case 8: Serial.println(F("your welcome")); break;
default : Serial.println(F("error")); break;
}
}
int key1 = 0;
boolean key2 = true;
int key4 = 0;
boolean key3 = true;
int data[14] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
}
char keypadreader() {
char key = 0;
delay(500);
keyPad.begin();
switch (keyPad.readKey())
{
case 0x4c: key = '1'; break;
case 0x4d: key = '4'; break;
case 0x4e: key = '7'; break;
case 0x4f: key = '*'; break;
case 0x54: key = '2'; break;
case 0x55: key = '5'; break;
case 0x56: key = '8'; break;
case 0x57: key = '0'; break;
case 0x64: key = '3'; break;
case 0x65: key = '6'; break;
case 0x66: key = '9'; break;
case 0x67: key = '#'; break;
case 0x74: key = 'A'; break;
case 0x75: key = 'B'; break;
case 0x76: key = 'C'; break;
case 0x77: key = 'D'; break;
default: break;
}
return key;
}