Show Posts
Pages: [1]
1  Using Arduino / Storage / Reading Sensor Log in TXT File on: October 31, 2012, 06:36:58 pm
Hi everyone,

I'm writing a sensor log in a TXT file in a SD card.  So, I write 1, 2, 3 in a TXT File... So far, so good  smiley-cool

But, I need to read this log and store into a int... Here is my problem... The value stored is only the last character. If has a 15 stored in file, the int returns 5.

Code:
int ior() {

int data;
 
myFile = SD.open("approved.txt");
 
  if (myFile){
     
    while (myfile.available()){
        data = myFile.read();
    }
   
  }
 
  return (data);
}

Somebody could help me?

Thanks in advance...
Pages: [1]