Go Down

Topic: Storing 1500 values from an excel file on SD card to arduino memory!! (Read 1 time) previous topic - next topic

v_m_a

I want to store 1500 integer values from an excel file to arduino memory as an array and later process them..
I am able to read comma separated values from serial and process them but not able to figure out how to read values from the sd card and then process them.. Plzz help..

AWOL

OK, assuming the integers are larger than single bytes, have you got a Mega, Due or Yun?
If you've got a Uno, think again.

v_m_a


v_m_a

in MEGA we can store 8kB of memory so memory won't be a limitation.. but what is the code.. or the coding approach.. to read integer data from a csv or excel file and store it in an array in arduino?

AWOL


in MEGA we can store 8kB of memory so memory won't be a limitation.. but what is the code.. or the coding approach.. to read integer data from a csv or excel file and store it in an array in arduino?

The same as always - open the file, read the file, close the file.

v_m_a

#5
Jun 16, 2014, 01:40 pm Last Edit: Jun 16, 2014, 03:04 pm by CrossRoads Reason: 1

Code: [Select]


#include<SD.h>
#include<SPI.h>

int val [20] ;
int count=0;
int k=0;
int CS_pin=53;
void setup()
{
 Serial.begin(9600);
 Serial.println("Initialising Card");
 pinMode(CS_pin,OUTPUT);
 
 if(!SD.begin(CS_pin))
 {
   Serial.println("Card Failed");
   return;
}
Serial.println("Card Ready");

File myFile;
myFile = SD.open("DATA.txt");
  while (myFile.available())
  {
      for (int i=0; i<=20 ; i++)
      {
        val[i]=myFile.parseInt();
         Serial.println(val[i]);
      }
 myFile.close();
  }

void loop() {}



I m new to arduino.. n wrote this code but its not working.. !! cn u help me debug it.. i ve just started with 20 values..

AWOL

Do you remember any italics in your code?
No.

Please modify your last post and add [font=Verdana][[/font]code] [font=Verdana][[/font]/code] tags to the code

Quote
i ve just started with 20 21 values.


v_m_a

done.. can you tell me what all is wrong with the code.. I m new to both arduino and coding.. or csn you please any links or book i ll find useful !! i ve been searching this forum for long but can't find an accurate solution or explanation..


Go Up