const byte myArray[] =
{
0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,
0x02,0x02,0x03,0x04,0x05,0x06,0x07,0x08,
0x03,0x02,0x03,0x04,0x05,0x06,0x07,0x08,
};
使用 PROGMEM 關鍵字, 同時
#include
const byte myArray[] PROGMEM=
{
0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,
0x02,0x02,0x03,0x04,0x05,0x06,0x07,0x08,
0x03,0x02,0x03,0x04,0x05,0x06,0x07,0x08,
};
在讀取時, 使用
pgm_read_byte_near(), ex:
int k; // counter variable
char myChar;
myChar = pgm_read_byte_near(myArray + k);
沒有留言:
張貼留言