So, i need to modifie code, that there are no posibility that two files are open at a time or just find a library that supports access to more than one file at a time.
Somehow i almost found solution to my second problem , but still it is not perfect, with some issues.
here is code:
#include <SD.h>
#include <SPI.h>
float u = 0;
File base;
int i = 30.0;
int sk = 0;
String inData;
void setup() {
Serial.begin(115200);
Serial.print("Initializing SD card...");
pinMode(10, OUTPUT);
digitalWrite(10, HIGH);
if (!SD.begin(4)) {
Serial.println("initialization failed!");
return;
}
Serial.println("initialization done.");
}
void loop()
{
char var = Serial.read();
switch (var) {
case 'u':
{
Serial.println("lasa");
base = SD.open("base.txt", FILE_READ);
while(base.available()) {
char a = base.read();
inData += a;
sk++;
u = (float)sk/i;
Serial.println(sk);
Serial.println(u);
if (u == 1 || u == 2 || u == 3 || u == 4 || u == 5 || u == 6 || u == 7 || u == 8 || u == 9){
Serial.print(inData);
Serial.println();
inData = 0;
}
}
base.close();
}
break;
}
}