Hello everyone!
I'm trying to do this project for several weeks, but RFID is causing problems... I need some help.
Objects:
1 keypad 4X3;
1 Stepper (28BYJ-48);
1 RFID ID 12 Innovations (125 KHz);
2 RFID Tags (125 KHz);
1 Arduino UNO R3.
My project: The person has a Login and a password. If the Login and the password are corrects, the person may choose another key in the keypad, if the person chosse "1", the stepper will make 10 steps, or chosse "2", the stepper will make 20 steps.
Then if the RFID ID 12 "sense" the first tag, the stepper will return the 10 steps, or "sense" the second tag, the stepper wiil return the 20 steps.
I do the login, password, stepper codes in my project. But I can't do the RFID code to works correctly. I saw many codes about this on the internet. But when I put in my project the keypad doesn't works and etc.
I saw the code about RFID ID 12 in Arduino.cc, but isnt I want. I used this code: http://bildr.org/2011/02/rfid-arduino/. I don't need use the serial monitor or SoftwareSerial library. Just make the stepper return.
And I have the Tags: "28004F5C5B60" and ""28004F542B18".
Any suggestion? Thanks!
#include <EEPROM.h>
#include <Keypad.h>
#include <Stepper.h>
int x;
int master;
int Login;
byte password;
byte reads;
const byte ROWS = 4;
const byte COLS = 3;
char keys[ROWS][COLS] = {
{'1','2','3'},
{'4','5','6'},
{'7','8','9'},
{'*','0','#'}
};
byte rowPins[ROWS] = {2, 3, 4, 5};
byte colPins[COLS] = {6, 7, 8};
Keypad kpd = Keypad(makeKeymap(keys), rowPins, colPins, ROWS, COLS);
const int stepsPerRevolution = 64;
Stepper myStepper(stepsPerRevolution, 9,10,11,12);
//----------------------------------
void setup(){
EEPROM.write(1, 31);
master = 0;
Login = 0;
password = 0;
reads = 0;
myStepper.setSpeed(300);
}
void loop(){
char key = kpd.getKey();
if(key){
switch(key){
case '1':
master = master + 1;
break;
case '2':
master = master - 2;
break;
case '3':
master = master * 3;
break;
case '4':
master = master + 4;
break;
case '5':
master = master - 5;
break;
case '6':
master = master * 6;
break;
case '7':
master = master + 7;
break;
case '8':
master = master - 8;
break;
case '9':
master = master * 9;
break;
case '*':
Login = abs(master);
master = 0;
break;
case '#':
password = abs(master);
delay (500);
reads = EEPROM.read(Login);
if(password == reads){
x = 10;
master = 0;
Login = 0;
password = 0;
}
break;
}
}
while(x == 10){
char key = kpd.getKey();
if(key){
switch(key){
case '1':
for(int j=0; j<32; j++){
myStepper.step(10);
}
//I THINK IS HERE THE RFID
x = 0;
break;
case '2':
for(int j=0; j<32; j++){
myStepper.step(20);
}
//I THINK IS HERE THE RFID
x = 0;
break;
}
}
}
}