Dear all,
I considered my self a newbie in arduino world.
I drafted a programme which is successfully working having 2D array of dimension [30][12], but I want to make it for whole year so my array will be [365][12] which making dynamic memory error (obviously) in Arduino UNO. So I planned to store all array in SD card and will fetch details from it.
I know to read data from SD but dont know how to map data available in sd with Arduino declared 2D Array?
Sharing a part of code to understand you (but it dont contain SD read function)
//+++++++++++++ Display Code Start +++++++++++++++++
#include <SPI.h>
#include <Adafruit_GFX.h>
#include <Adafruit_PCD8544.h>
#include <DS3232RTC.h>
#include <Wire.h>
// Software SPI (slower updates, more flexible pin options):
// pin 7 - Serial clock out (SCLK)
// pin 6 - Serial data out (DIN)
// pin 5 - Data/Command select (D/C)
// pin 4 - LCD chip select (CS)
// pin 3 - LCD reset (RST)
Adafruit_PCD8544 display = Adafruit_PCD8544(7, 6, 5, 4, 3);
//PIN A5 - SCL
//PIN A4 - SDA
#define NUMFLAKES 10
#define XPOS 0
#define YPOS 1
#define DELTAY 2
#define LOGO16_GLCD_HEIGHT 16
#define LOGO16_GLCD_WIDTH 16
uint_least8_t rowID;
uint_least8_t colID;
char Temp[] = "000.00";
char temperature_msb;
byte temperature_lsb;
//+++++++++++++++++++++++++++++++++
uint_least8_t Month1;
uint_least8_t Day1;
uint_least8_t FajH;
uint_least8_t ZuhH;
uint_least8_t AsrH;
uint_least8_t MagH;
uint_least8_t IshH;
uint_least8_t FajM;
uint_least8_t ZuhM;
uint_least8_t AsrM;
uint_least8_t MagM;
uint_least8_t IshM;
uint_least8_t arrayTable = {
{8,1,4,50,12,27,3,43,6,47,8,3},
{8,2,4,51,12,26,3,42,6,47,8,2},
{8,3,4,51,12,26,3,41,6,47,8,2},
{8,4,4,51,12,26,3,41,6,46,8,1},
{8,5,4,52,12,26,3,40,6,46,8,1},
{8,6,4,52,12,26,3,39,6,46,8,0},
{8,7,4,52,12,26,3,39,6,45,8,0},
{8,8,4,53,12,26,3,38,6,45,7,59},
{8,9,4,53,12,26,3,37,6,44,7,59},
{8,10,4,53,12,26,3,36,6,44,7,58},
{8,11,4,53,12,25,3,36,6,43,7,58},
{8,12,4,54,12,25,3,35,6,43,7,57},
{8,13,4,54,12,25,3,34,6,42,7,56},
{8,14,4,54,12,25,3,33,6,42,7,56},
{8,15,4,54,12,25,3,32,6,41,7,55},
{8,16,4,55,12,25,3,31,6,41,7,54},
{8,17,4,55,12,24,3,30,6,40,7,54},
{8,18,4,55,12,24,3,29,6,40,7,53},
{8,19,4,55,12,24,3,29,6,39,7,52},
{8,20,4,56,12,24,3,30,6,39,7,52},
{8,21,4,56,12,23,3,30,6,38,7,51},
{8,22,4,56,12,23,3,30,6,38,7,50},
{8,23,4,56,12,23,3,31,6,37,7,50},
{8,24,4,56,12,23,3,31,6,36,7,49},
{8,25,4,56,12,22,3,31,6,36,7,48},
{8,26,4,57,12,22,3,31,6,35,7,48},
{8,27,4,57,12,22,3,31,6,35,7,47},
{8,28,4,57,12,22,3,32,6,34,7,46},
{8,29,4,57,12,21,3,32,6,33,7,45},
{8,30,4,57,12,21,3,32,6,33,7,45},
{8,31,4,57,12,21,3,32,6,32,7,44},
{9,1,4,58,12,20,3,32,6,31,7,43},
{9,2,4,58,12,20,3,32,6,31,7,42},
{9,3,4,58,12,20,3,32,6,30,7,42},
{9,4,4,58,12,19,3,32,6,29,7,41},
{9,5,4,58,12,19,3,32,6,29,7,40},
{9,6,4,58,12,19,3,33,6,28,7,39},
{9,7,4,58,12,18,3,33,6,27,7,39},
{9,8,4,58,12,18,3,33,6,27,7,38},
{9,9,4,58,12,18,3,33,6,26,7,37},
{9,10,4,58,12,17,3,33,6,25,7,36},
{9,11,4,58,12,17,3,33,6,25,7,36},
{9,12,4,58,12,17,3,33,6,24,7,35},
{9,13,4,59,12,16,3,32,6,23,7,34},
{9,14,4,59,12,16,3,32,6,22,7,33},
{9,15,4,59,12,16,3,32,6,22,7,32},
{9,16,4,59,12,15,3,32,6,21,7,32},
{9,17,4,59,12,15,3,32,6,20,7,31},
{9,18,4,59,12,14,3,32,6,20,7,30},
{9,19,4,59,12,14,3,32,6,19,7,29},
{9,20,4,59,12,14,3,32,6,18,7,29},
{9,21,4,59,12,13,3,32,6,17,7,28},
{9,22,4,59,12,13,3,32,6,17,7,27},
{9,23,4,59,12,13,3,31,6,16,7,26},
{9,24,4,59,12,12,3,31,6,15,7,26},
{9,25,4,59,12,12,3,31,6,15,7,25},
{9,26,4,59,12,12,3,31,6,14,7,24},
{9,27,4,59,12,11,3,31,6,13,7,24},
{9,28,4,59,12,11,3,31,6,12,7,23},
{9,29,4,59,12,11,3,30,6,12,7,22},
{9,30,4,59,12,10,3,30,6,11,7,22};
};
void display1(int Month1, int Day1)
{
for (uint_least8_t rowID=0;rowID<31;rowID++) {
for (uint_least8_t colID=0;colID<12;colID=0) {
uint_least8_t m= arrayTable[rowID][colID];
if(m!=Month1)
{
break ;
}
else if(m==Month1)
{
uint_least8_t d=arrayTable[rowID][colID+1];
if(d!=Day1)
{
break ;
}
else if(d==Day1)
{
}
FajH=(arrayTable[rowID][colID+2]);
FajM=(arrayTable[rowID][colID+3]);
ZuhH=(arrayTable[rowID][colID+4]);
ZuhM=(arrayTable[rowID][colID+5]);
AsrH=(arrayTable[rowID][colID+6]);
AsrM=(arrayTable[rowID][colID+7]);
MagH=(arrayTable[rowID][colID+8]);
MagM=(arrayTable[rowID][colID+9]);
IshH=(arrayTable[rowID][colID+10]);
IshM=(arrayTable[rowID][colID+11]);
break;
break;
}
}
}
}
void setup(){
// All setup for NOkia 5110 display
display1(Month1, Day1); // call above declared function, value of Month1, Day1 coming from RTC
}
void loop ()
{
//Printing output value of display1 on Nokia5110 (i.e., FajH, FajM, ZuhH, ZuhM...........)
}
I want to read only data from SD card for 2D array????
Anyone please suggest...
Thanks in Advance
Anas Hasan
India