Advertisement
pleasedontcode

PROGMEM example

Aug 29th, 2024
146
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Arduino 0.33 KB | Source Code | 0 0
  1. #include <avr/pgmspace.h>
  2.  
  3. const char message[] PROGMEM = "Hello, World!";  // Store string in FLASH
  4.  
  5. void setup() {
  6.     Serial.begin(9600);
  7.    
  8.     // Read and print the message from FLASH
  9.     char buffer[20];
  10.     strcpy_P(buffer, (PGM_P)message);
  11.     Serial.println(buffer);
  12. }
  13.  
  14. void loop() {
  15.     // Your loop code
  16. }
  17.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement