Go Down

Topic: Save changes into SD (Read 2 times) previous topic - next topic

dgelectron

So, how must be done to return every single character before "\n"?? Thats what i'm looking for. When the program reads:
Code: [Select]
Serial.write(dataFile.read());
Print all the characters not just one...

Thanks PaulS!

tuxduino

Some pseudocode to get you started:

Code: [Select]

char buffer[BUFLEN];
int cnt = 0;

ch = read one byte from file
if it's \n, then
    buffer[cnt]=0
    do something with buffer
    cnt=0
else
    if (cnt < BUFLEN-1) then
        buffer[cnt] = ch
        cnt++
    endif
endif

PaulS

Quote
When the program reads:
Code:

Serial.write(dataFile.read());

Print all the characters not just one...

Change that to Serial.println() and see what happens.

dgelectron

Hi guys,

First of all thanks for your replies. I'm a total amateur with this so i can find a solution. Cause i'm running out of time i'. gonna try to find other way instead of the SD card. I think the EEPROM can be a good option too. Right now i have a code to learn how to use EEPROM but im going to open a new topic cause i don't want to mix things in the forum.

Thanks a lot.

Go Up