I am trying to upload to my nano the code attached. It is giving me an error saying variable must be const about something I am trying to put in progrem. I learned that installing a older version of the compiler worked. However I was wondering is there a way to just edit the code to make it work. I tried putting const before it but it didn't work. It is on line 78 and 79 of the first file.
const extern PGM_P *NApowerCodes[] PROGMEM;
const extern PGM_P *EUpowerCodes[] PROGMEM;
-
Could you please post the concerning lines of code. You can't expect us to go to a webpage, find and download a zip, open it, just to see the code.Gerben– Gerben2015年04月14日 16:33:37 +00:00Commented Apr 14, 2015 at 16:33
-
Which version of the IDE are you using? I was able to compile to code on 1.0.5rslite– rslite2015年04月16日 02:41:16 +00:00Commented Apr 16, 2015 at 2:41
-
I am using the latest version, I believe 1.0.06. I was able to compile it with your version but would like to know how to fix it.NULL– NULL2015年04月16日 11:05:52 +00:00Commented Apr 16, 2015 at 11:05
1 Answer 1
Using the source from this link I got it to compile following these steps.
- Before opening the sketch in the Arduino:
- Rename TVB.pde to TVB.ino
- Rename WORLDcodes.cpp to WORLDcodes.h
- Open the sketch (TVB.ino) in the Arduino IDE
Edit main.h and change:
// The structure of compressed code entries struct IrCode { uint8_t timer_val; uint8_t numpairs; uint8_t bitcompression; uint16_t const *times; uint8_t const*codes; };
to:
// The structure of compressed code entries struct IrCode { uint8_t timer_val; uint8_t numpairs; uint8_t bitcompression; uint16_t const *times; uint8_t const*codes PROGMEM; };
That is, add
PROGMEM
to thecodes
line.
Edit TVB.ino and change:
extern PGM_P *NApowerCodes[] PROGMEM; extern PGM_P *EUpowerCodes[] PROGMEM; extern uint8_t num_NAcodes, num_EUcodes;
to:
#include "WORLDcodes.h"
This avoids some linker problems in the original code.
Edit WORLDcodes.h and delete the line:
#include "main.h"
Continue editing WORLDcodes.h and change:
const struct IrCode *NApowerCodes[] PROGMEM = {
to:
const struct IrCode * const NApowerCodes[] PROGMEM = {
And also change:
const struct IrCode *EUpowerCodes[] PROGMEM = {
to:
const struct IrCode * const EUpowerCodes[] PROGMEM = {
It should now compile OK.