Function named F() causes unresolvable errors.

I'm in the middle of writing a program to blink out messages in Morse code on the built in LED, and as such I have a function labeled with each letter of the alphabet that flashes out that single letter. If you have a function such as void F() {// do something or not, doesn't matter}, it will cause a bunch of error messages compiling. Change the name, and it works fine. Try it, create a sketch with nothing but

void F() { }

and it will not compile. Change the letter to G, for example, and it compiles.

I can't seem to find any information if a built-in function exists with that name, nor that it is forbidden to use. Any Arduino IDE gurus want to give me some insight?

You can't use the name F for a function. It is a macro that is used to put strings into PROGMEM. AFAIK it is only documented in one place:


This probably one of the most important features of 1.0, while at the same time being the least known (or documented.)

Thank you! I had already given up and changed the name. I read that page, and I still have no idea what F() does, exactly. The same line of code without the F() enclosing the string appears to do the same thing. i.e. on the same page:

Serial.print("Hello world.") gives "Hello world."

You can pass flash-memory based strings to Serial.print() by wrapping them with F(). For example :

Serial.print(F(“Hello World”))

What is a "flash-memory based string"? Does F() simply store the string to EEPROM instead of program RAM?

davidlvann: What is a "flash-memory based string"? Does F() simply store the string to EEPROM instead of program RAM?

There are three seperate memory spaces on the ATmega: FLASH (PROGMEM), RAM, and EEPROM.

Strings wrapped with F() will be kept in PROGMEM, which is the largest memory space available. Without F() they are copied to RAM during run-time and generally lead to problems with running out of RAM.

I am saying it is not EEPROM because that is a specific memory space on the ATmega, which isn't used in this case.