I am trying to use progspace to store a static table of strings. I have it now defined in the program and its using several Kbytes of my Mega 2560.
The include file is modelled after the code for PROGMEM which is on the Reference page.
However, I can't get a simple test program to compile (see below). Compilation returns the following error:
c:/program files/arduino/hardware/tools/avr/lib/gcc/../../avr/include/stdlib.h:54: error: expected ',' or ';' before 'extern'
Any ideas of what is causing the error. I read a post that referred to a bug in the libraries for the Mega 2560, so I compiled it for the Uno and received the same error. I also moved the include of the progspace library from the included file to the main file also with no luck. Paranoid (because the error refers to stdio.h), I also re-compiled an older program, but that worked.
The test program in include file are shown below:
// setup use of program memory
#include "avr/pgmspace.h"
// setup move commands
#include "pMoveCommands.h"
byte MoveIndex=0;
int LocalIndex;
int randomPin=2;
const char scbase[]={"#3P"};
const char qs[]={"VA"};
void setup()
{
Serial.begin(9600);
randomSeed(analogRead(randomPin));
}
void loop()
{
}
prog_char Command_1[]PROGMEM = "#0P1500#1P1500#2P1000#3P570#4P1500#5P2400#6P510#8P1500#9P1500#10P1500#11P1400T1000";
prog_char Command_2[]PROGMEM = "#2P1100";
prog_char Command_3[]PROGMEM = "#0P2000 #1P1100 T100";
prog_char Command_4[]PROGMEM = "#2P750";
prog_char Command_5[]PROGMEM = "#2P1000";
prog_char Command_6[]PROGMEM = "#2P1000 T3000";
prog_char Command_7[]PROGMEM = "#2P1500 T2000";
prog_char Command_8[]PROGMEM = "#2P1200";
prog_char Command_9[]PROGMEM = "#2P2000";
prog_char Command_10[]PROGMEM = "#2P2000 T3000";
prog_char Command_11[]PROGMEM = "#0P1500 #1P1500 T100";
prog_char Command_12[]PROGMEM = "#0P1100 #1P1100 T100";
prog_char Command_13[]PROGMEM = "#0P2000 #1P2000 T100";
prog_char Command_14[]PROGMEM = "#0P1100 #1P1100 T1500";
prog_char Command_15[]PROGMEM = "#0P1500 #1P1500 T1500";
prog_char Command_16[]PROGMEM = "#0P2000 #1P2000 T1500";
prog_char Command_17[]PROGMEM = "#9P1000S2000 T500";
prog_char Command_18[]PROGMEM = "#9P2250S2000 T500";
prog_char Command_19[]PROGMEM = "#8P2250S1667 T500";
prog_char Command_20[]PROGMEM = "#8P1500S1667 T500";
prog_char Command_21[]PROGMEM = "#8P750S1667 T300";
prog_char Command_22[]PROGMEM = "#11P1200S1000 T750";
prog_char Command_23[]PROGMEM = "#11P1800S1000 T750";
prog_char Command_24[]PROGMEM = "#10P1100S1667 T750";
prog_char Command_25[]PROGMEM = "#10P1900S1667 T750";
prog_char Command_26[]PROGMEM = "#9P860S3000 #11P2500S1500";
prog_char Command_27[]PROGMEM = "#9P900S2500 #11P1200S1500 #8P900S3000 #10P900S2500";
prog_char Command_28[]PROGMEM = "#9P1500S2000 #11P1500S1000 T500";
prog_char Command_29[]PROGMEM = "#9P2200S3000 #11P870S1500";
prog_char Command_30[]PROGMEM = "#10P1100S1667 #8P2250S1667 T500";
prog_char Command_31[]PROGMEM = "#10P1500S1667 #8P1500S1667 T500";
prog_char Command_32[]PROGMEM = "#10P2200S1667 #8P750S1667 T500";
prog_char Command_33[]PROGMEM = "#8P1500S1667 #9P1500S2000 #10P1500S1667 #11P1500S1000 T500";
prog_char Command_34[]PROGMEM = "#8P1500S1667 #9P1500S2000 #10P1500S1667 #11P1500S1000 T1500";
prog_char Command_35[]PROGMEM = "#5P1200 T100";
prog_char Command_36[]PROGMEM = "#5P1850 T100";
prog_char Command_37[]PROGMEM = "#5P2500 T100";
prog_char Command_38[]PROGMEM = "#6P1500 T100";
prog_char Command_39[]PROGMEM = "#6P950 T100";
prog_char Command_40[]PROGMEM = "#6P650 T100";
prog_char Command_41[]PROGMEM = "#6P1500 T100";
prog_char Command_42[]PROGMEM = "#5P1200 #61850 T100" ;
prog_char Command_43[]PROGMEM = "#5P1850 #6P950 T100";
prog_char Command_44[]PROGMEM = "#5P2500 #6P650 T100";
prog_char Command_45[]PROGMEM = "#4P2200";
prog_char Command_46[]PROGMEM = "#4P1500";
prog_char Command_47[]PROGMEM = "#4P750";
prog_char Command_48[]PROGMEM = "#4P2200T1000";
prog_char Command_49[]PROGMEM = "#4P1500T1000";
prog_char Command_50[]PROGMEM = "#4P750T1000";
prog_char Command_51[]PROGMEM = "#9P1500S2000 #11P1500S1000 #8P1000S1667 #10P1000S1667 T300";
prog_char Command_52[]PROGMEM = "#9P2100S2000 #11P1800S1000 #8P1000S1667 #10P1000S1667 T300";
prog_char Command_53[]PROGMEM = "#9P2100S2000 #11P1800S1000 #8P1500S1667 #10P1500S1667 T300";
prog_char Command_54[]PROGMEM = "#9P2100S2000 #11P1800S1000 #8P2000S1667 #10P2000S1667 T300";
prog_char Command_55[]PROGMEM = "#9P1500S2000 #11P1500S1000 #8P2000S1667 #10P2000S1667 T300";
prog_char Command_56[]PROGMEM = "#9P900S2000 #11P1200S1000 #8P2000S1667 #10P2000S1667 T300";
prog_char Command_57[]PROGMEM = "#9P900S2000 #11P1200S1000 #8P1500S1667 #10P1500S1667 T300";
prog_char Command_58[]PROGMEM = "#9P900S2000 #11P1200S1000 #8P1000S1667 #10P900S1667 T300";
prog_char Command_59[]PROGMEM = "#3P570";
prog_char Command_60[]PROGMEM = "#3P600";
prog_char Command_61[]PROGMEM = "#3P680";
prog_char Command_62[]PROGMEM = "#3P790";
prog_char Command_63[]PROGMEM = "#3P1005";
prog_char Command_64[]PROGMEM = "End";
PROGMEM const char *MoveCommands[] =
{
Command_1,
Command_2,
Command_3,
Command_4,
Command_5,
Command_6,
Command_7,
Command_8,
Command_9,
Command_10,
Command_11,
Command_12,
Command_13,
Command_14,
Command_15,
Command_16,
Command_17,
Command_18,
Command_19,
Command_20,
Command_21,
Command_22,
Command_23,
Command_24,
Command_25,
Command_26,
Command_27,
Command_28,
Command_29,
Command_30,
Command_31,
Command_32,
Command_33,
Command_34,
Command_35,
Command_36,
Command_37,
Command_38,
Command_39,
Command_40,
Command_41,
Command_42,
Command_42,
Command_44,
Command_45,
Command_46,
Command_47,
Command_48,
Command_49,
Command_50,
Command_51,
Command_52,
Command_53,
Command_54,
Command_55,
Command_56,
Command_57,
Command_58,
Command_59,
Command_60,
Command_61,
Command_62,
Command_63,
Command_64
}