o to wypociny dzisiejszej nocy udało mi się odczytać dane do osobnych kolumn i oto właśnie mi chodziło ale jest problem ze to zmienna string jak zrobić konwersje do char
pomoże ktos
Kod:
#include <SPI.h>
#include <SD.h>
File myFile;
char dana;
String bufor;
char buforst[504];
long i;
void setup() {
// Open serial communications and wait for port to open:
Serial.begin(9600);
while (!Serial) {
; // wait for serial port to connect. Needed for native USB port only
}
Serial.print("Initializing SD card...");
if (!SD.begin(4)) {
Serial.println("initialization failed!");
return;
}
Serial.println("initialization done.");
// re-open the file for reading:
myFile = SD.open("test.txt");
if (myFile) {
Serial.println("test.txt:");
// read from the file until there's nothing else in it:
while (myFile.available()) {
for(int b=0;b<4;b++){
dana=myFile.read();
bufor=bufor+String(dana);
}
Serial.println(bufor);
i++;
// buforst[i]=bufor;
Serial.println(i);
bufor.toCharArray(buforst, 504) ;
// buforst[i]=char(bufor);
bufor="";
}
for(int b=0;b<504;b++){
Serial.println(buforst[b]);
}
// close the file:
myFile.close();
} else {
// if the file didn't open, print an error:
}
}
void loop() {
// nothing happens after setup
}
Jeśli pomogłem podziękuj punktem reputacji