#include <avr/pgmspace.h>
const char nick_0[] PROGMEM = "Ursula";
const char nick_1[] PROGMEM = "Dschafar";
const char nick_2[] PROGMEM = "Scar";
const char nick_3[] PROGMEM = "Huk";
const char nick_4[] PROGMEM = "Cruella";
const char* const nick_table[] PROGMEM = { nick_0, nick_1, nick_2, nick_3, nick_4 };
constexpr uint8_t MAX_NICK_IDX {(sizeof(nick_table) / sizeof(uint16_t)) - 1}; // Anzahl der Namen in nick_table
constexpr uint8_t MAX_NICKBUFFER_CHARS {10}; // Naximale Nicknamenlänge
const unsigned char* getNick(uint8_t id, char* buffer) {
strcpy_P(buffer,(char*)pgm_read_word(&(nick_table[id])));
}
void setup() {
Serial.begin(115200);
}
void loop() {
static const char nickname[MAX_NICKBUFFER_CHARS];
for (uint8_t i= 0; i <= MAX_NICK_IDX; i++) {
getNick(i, nickname);
Serial.println(nickname);
}
delay(2000);
}