#include <avr/pgmspace.h>
const uint8_t mCylonScan[10][N_LED] PROGMEM = {
{255,0,0,0,0,0},
{0,255,0,0,0,0},
{0,0,255,0,0,0},
{0,0,0,255,0,0},
{0,0,0,0,255,0},
{0,0,0,0,0,255},
{0,0,0,0,255,0},
{0,0,0,255,0,0},
{0,0,255,0,0,0},
{0,255,0,0,0,0}
};
Then to access the data you just do the following (where 'i' and 'j' are loop variables):
data = pgm_read_byte(&(mCylonScan[i][j]));
See the AVR libc docs for more details.
You just saved me......thanks a lot
ReplyDeletehow to pass this array to a function and use there?
ReplyDeletethanks.
This is just standard C. I'd suggest passing it as a pointer. Here's a tutorial on passing arrays to functions in C:
Deletehttp://www.tutorialspoint.com/cprogramming/c_passing_arrays_to_functions.htm
Big Thanks!!!
ReplyDelete