Hi all,
I trie to log each reading from a RFID Reader ID-20 On a SD card.
To have a tree y keep the 8 first char to my Tag to name a created folder with a .csv file on it.
it work but when I insist with the the Rfid I’ve an overflow.
Init SD [OK]
Server is [OK] : http:// 10.11.12.1
********Setup [OK] **********
4B00DDBA/open.csv
Folder exist !
4B00DDBA/open.csv
Folder exist !
B00DDBA68444B00DDBA68444B00DDBA/open.csv
4B00DDBA68444B00DDBA68444B00DDBA68444B00DDBA/open.csv
A/open.csv
Error open file!
4B00DDBAsv/open.csv
4B00DDBA684444B00DDBAsv/open.csv
4B00DDBAsv
Error creating folder!
Error open file!
4B00DDBAsv/open.csv
4B00DDBA684444B00DD
//====================== RFID
while(Serial.available()){
int readByte = Serial.read(); //read next available byte
if(readByte == 2) reading = true; //begining of tag
if(readByte == 3) reading = false; //end of tag
if(reading && readByte != 2 && readByte != 10 && readByte != 13){
//store the tag
tagString[index] = readByte;
index ++;
if (cpt <= 7){
tagStringFolder[index2] = readByte;
index2 ++;
cpt ++;
}
}
void checkTag(char tag[]){
///////////////////////////////////
// Check if the Tag can('t) open thie door
///////////////////////////////////
if(strlen(tag) == 0) return; //empty, no need to contunue
// Concat
if (!strcat( filePath, tagStringFolder)) {
Serial.println("Erreur concat !");
return;
}else{
strcat( filePath, fileName);
Serial.println(filePath);
}
if (!SD.exists(tagStringFolder)) { // -=newTag=-
//================ New String ==============
// *** En faire une Fonction New string a appeler apres Vérification
if(strlen(tagString) != 0){
Serial.println(tagString);
Serial.println(tagStringFolder);
}
if (! SD.mkdir(tagStringFolder)) Serial.println("Error creating folder!");
if (!SD.open(filePath, FILE_WRITE))Serial.println("Error open file!");
}else{
Serial.println(" Folder exist !");
// Si folder exist alors lire les droits
if (SD.exists(filePath)){
//openLock
for(pos = 0; pos < 180; pos += 1) // goes from 0 degrees to 180 degrees
{ // in steps of 1 degree
myservo.write(pos); // tell servo to go to position in variable 'pos'
delay(15); // waits 15ms for the servo to reach the position
}
delay(1000);
//closeLock
for(pos = 180; pos>=1; pos-=1) // goes from 180 degrees to 0 degrees
{
myservo.write(pos); // tell servo to go to position in variable 'pos'
delay(15); // waits 15ms for the servo to reach the position
}
}else{
Serial.println("Error Opening File");
Serial.println(filePath);
}
}
filePath[0] = '\0';
}
}
void clearTag(char one[]){
///////////////////////////////////
//clear the char array by filling with null - ASCII 0
//Will think same tag has been read otherwise
///////////////////////////////////
for(int i = 0; i < strlen(one); i++){
one[i] = 0;
}
}
If anybody have an idea
Thanks.