How to store in an SD card an array of bytes

hi!

I have in my arduino project a bunch of arrays that look like this:

static const byte ASCII[][5] = {
  {0x00, 0x00, 0x00, 0x00, 0x00}
  ,{0x00, 0x00, 0x5f, 0x00, 0x00}
  ,{0x00, 0x07, 0x00, 0x07, 0x00}
  ,{0x14, 0x7f, 0x14, 0x7f, 0x14}
  ,{0x24, 0x2a, 0x7f, 0x2a, 0x12}
  ,{0x23, 0x13, 0x08, 0x64, 0x62}
  ,{0x36, 0x49, 0x55, 0x22, 0x50}
 ... more values...
};

Can anyone give me a hand so I can be able to create a few files in a SD card, and later on read them with Arduino?

  • The file do not need to me created with Arduino, can be with notepad.
  • Each array can be stored in a different file.
  • I'm using a arduino MEGA with a CC3000 wifi shield with SD card slot

Do the files have to be readable with notepad? The reason I ask is bytes like 0x00 aren't printable characters that notepad can display on your screen.

If you must have files that are editable with notepad (a good idea) then you need a way of encoding these values as ASCII text. Maybe just write the numbers with commas between? Then the Arduino has to read the numbers and count the commas.

Hi!

Notepad does not have to be able to read them, not even create them at all.
I just mentioned notepad in case if that would be an option, I can create the files with an Arduino if needed.

So if I understand correctly, you are putting 2 options on the table:

1º: Create and read the files only with Arduino, Notepad will not be able to read them.

2º: Create the file with notepad, that Arduino would be able to translate into bytes.

I like the 2º option better, I think it would give me better control over the files creation.

Any suggestion on how to achieve that?