0

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;

asked Apr 14, 2015 at 16:24
3
  • 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. Commented Apr 14, 2015 at 16:33
  • Which version of the IDE are you using? I was able to compile to code on 1.0.5 Commented 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. Commented Apr 16, 2015 at 11:05

1 Answer 1

0

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 the codes 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.

answered Aug 22, 2015 at 1:40
0

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.