problems with <avr/pgmspace.h>


I’m using an “Arduino Uno”, under Ubuntu with arduino 1.0.1.

I need to use PROGMEM but it seems that I’m doing something wrong,
even when I try something as simple as:

#include <avr/pgmspace.h>

PROGMEM  prog_uint16_t charSet[]  = { 65000, 32796, 16843, 10, 11234};

void setup(){

void loop(){

I get the following error:

pm.cpp:6:10: error: ‘prog_uint16_t’ does not name a type

Notice that even the error num line is wrong,

the avr/pgmspace.h exists, and arduino finds it, as I have checked that if I write <avr/pgmspace22.h> (just to invent something) then the error is “file not found…”

Any idea??


try uint16_t instead of prog_uint16_t

Duane B

Thanks a lot Duane :slight_smile:
your solution was almost right.

using uint16_t instead of prog_uint16_t
I got the error:
pm.cpp:6:27: error: variable ‘charSet’ must be const in order to be put into read-only section by means of ‘attribute((progmem))’

and using
PROGMEM const uint16_t charSet = { 65000, 32796, 16843, 10, 11234};
worked perfectly.

I am using the example code in
Should I contact someone to update it, or this problem just happened to me?

My understanding is that a lot of the content in the playground is outdated and that noone is particularly active in correcting it.

You may be able to edit it yourself, I think that was the original intention anyway.

Duane B