PRJ - F Macro#

2024-05-29

/*
# 用 F() 向串口打印能不占用 RAM 空间

## Description

When an instruction like :

Serial.print("Write something on  the Serial Monitor");

is used, the string to be printed is normally saved in RAM. If your sketch prints a lot of stuff on the Serial Monitor, you can easily fill the RAM. If you have free FLASH memory space, you can easily indicate that the string must be saved in FLASH using the syntax:

Serial.print(F("Write something on the Serial Monitor that is stored in FLASH"));

## See also

PROGMEM

## Reference

[PROGMEM - Arduino Reference](https://www.arduino.cc/reference/en/language/variables/utilities/progmem/)

*/

void setup() {
  // put your setup code here, to run once:
  Serial.begin(9600);
  Serial.print(F("Write something on the Serial Monitor that is stored in FLASH\n"));
  Serial.print(F("Write something on the Serial Monitor that is stored in FLASH\n"));
  Serial.print(F("Write something on the Serial Monitor that is stored in FLASH\n"));
  Serial.print(F("Write something on the Serial Monitor that is stored in FLASH\n"));
  Serial.print(F("Write something on the Serial Monitor that is stored in FLASH\n"));
  Serial.print(F("Write something on the Serial Monitor that is stored in FLASH\n"));
  Serial.print(F("Write something on the Serial Monitor that is stored in FLASH\n"));
  Serial.print(F("Write something on the Serial Monitor that is stored in FLASH\n"));
  Serial.print(F("Write something on the Serial Monitor that is stored in FLASH\n"));
  Serial.print(F("Write something on the Serial Monitor that is stored in FLASH\n"));
  Serial.print(F("Write something on the Serial Monitor that is stored in FLASH\n"));
  Serial.print(F("Write something on the Serial Monitor that is stored in FLASH\n"));
  Serial.print(F("Write something on the Serial Monitor that is stored in FLASH\n"));
  Serial.print(F("Write something on the Serial Monitor that is stored in FLASH\n"));
}

void loop() {
  // put your main code here, to run repeatedly:

}