For an ethernet project I do, I need to store the Ethernet Shield's MAC address. I store it like that:

byte mac[] = { 0x90, 0xA2, 0xDA, 0x0F, 0xE1, 0x85 };

That works OK, but in my project I need all the SRAM available, so every byte of memory is important. I've used the F() macro and PROGMEM everywhere, but I couldn't manage to store the MAC byte array in the PROGMEM.

How can I store it in PROGMEM? Is it even possible?

  • 1
    Try "const byte mac[] PROGMEM = { ... };" arduino.cc/en/Reference/PROGMEM Commented Jan 16, 2016 at 11:30
  • MAC addresses are usually configurable, so I'd rather store it in EEPROM. Commented Jan 16, 2016 at 17:34
  • 1
    Since the original question indicated the OP was having trouble accessing PROGMEM, s/he may also have problems with EEPROM. Could you perhaps expand your answer with a code snippet that illustrates how your suggestion would work?
    – Nick Gammon
    Commented Jan 17, 2016 at 3:54
  • As it stands, this would make more sense as a comment. But if you can address the OP's issue – how to store the MAC address outside of SRAM then it would be a good answer.
    – dlu
    Commented Jan 17, 2016 at 8:22

1 Answer 1


See Putting constant data into program memory (PROGMEM) for tips about putting stuff into PROGMEM. However personally I wouldn't get too excited about saving 6 bytes.

Example code:

Declare data globally:

const byte mac [6] PROGMEM = { 0x90, 0xA2, 0xDA, 0x0F, 0xE1, 0x85 };

Get a copy for use into a temporary variable:

  char foo [6];
  memcpy_P (foo, mac, sizeof foo);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.