Go Down

Topic: Problem and errors with my sketch for Arduino Uno [LOL Protoshield] [LEDs] (Read 1 time) previous topic - next topic

Raizen1337

NO you can' remove the *, it means it's a pointer... if you remove it then you've changed the behavior... you'll have bugs...

for example this is how you declare individual strings in PROGMEM and then an array of those strings. Each entry in the array is a pointer.

Code: [Select]
#include <avr/pgmspace.h>
const char string_0[] PROGMEM = "String 0";   
const char string_1[] PROGMEM = "String 1";
const char string_2[] PROGMEM = "String 2";
const char string_3[] PROGMEM = "String 3";
const char string_4[] PROGMEM = "String 4";
const char string_5[] PROGMEM = "String 5";
// Then set up a table to refer to your strings.
const char* const string_table[] PROGMEM = {string_0, string_1, string_2, string_3, string_4, string_5};




Oh. I knew that * means something.. but I tottaly forgot it means a pointer :/
It's bad that I deleted the * then saved? But i put it back... Do i get bugs now too?


I put the * back and this is my error:

Code: [Select]
Arduino: 1.8.1 (Windows 7), Board: "Arduino/Genuino Uno"

In file included from C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/Arduino.h:28:0,

                 from sketch\Chronos.ino.cpp:1:

Chronos:169: error: variable 'sentence_table' must be const in order to be put into read-only section by means of '__attribute__((progmem))'

 const unsigned char *sentence_table[] PROGMEM = {

                                       ^

Chronos:188: error: variable 'bitmap_table' must be const in order to be put into read-only section by means of '__attribute__((progmem))'

 const unsigned char *bitmap_table[] PROGMEM = {

                                     ^

exit status 1
variable 'sentence_table' must be const in order to be put into read-only section by means of '__attribute__((progmem))'

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.
 


Can you still help me how to fix this? Please :)

Should i change it to "const char* const XXX" like you linekd in the code?

J-M-L

Hello - Please do not PM me for help,  others will benefit as well if you post your question publicly on the forums.
Bonjour Pas de messages privés SVP, postez dans le forum directement pour que ça profite à tous

Raizen1337

If you mean this:
(there are more cost unsigned char before this but i post some of them)

Code: [Select]
onst unsigned char Sixteen[] PROGMEM = {8, 187, 7, 129, 14, 194, 187, 7, 191, 128, 141,0};
const unsigned char Seventeen[] PROGMEM = {8, 187, 7, 129, 14, 194, 187, 7, 191, 128, 141,0};
const unsigned char Eighteen[] PROGMEM = {154, 4, 191, 128, 141,0};
const unsigned char Nineteen[] PROGMEM = {141, 7, 15, 155, 141, 191, 128, 8, 141,0};
const unsigned char Twenty[] PROGMEM = {8, 7, 191, 7, 147, 131, 141, 7, 191, 128,0};
const unsigned char Goodnight[] PROGMEM = {2,8, 179, 138, 138, 177, 141, 155, 191,0}; // 28
const unsigned char Hello[] PROGMEM = {183, 7, 159, 146, 164,0};
const unsigned char oClock [] PROGMEM = {8,137,8, 195, 7, 146, 8, 136, 197,0};
const unsigned char setupok[] PROGMEM = {2,187, 130, 191, 133, 199, 2, 137, 194,8, 154,0};
const unsigned char Oh [] PROGMEM = {8,137,0};

const unsigned char *sentence_table[] PROGMEM = {
    Setup,HelloMyNameisClonos,Pistol,BigBen,Beep,TheTimeIs,TheTemperatureIs,Degrees,One,Two,Three,Four,Five,Six,Seven,Eight,Nine,Ten,Eleven,
    Twelve,Thirteen,Fourteen,Fifteen,Sixteen,Seventeen,Eighteen,Nineteen,Twenty,
    Goodnight,Hello,oClock,setupok,Oh
};




and


Code: [Select]
const unsigned char fontZero[] PROGMEM  = {14,10,10,10,14,255,255,255,255,255,255,255,255,255,0};
const unsigned char fontOne[] PROGMEM  = {4,6,4,4,14,255,255,255,255,255,255,255,255,255,0};
const unsigned char fontTwo[] PROGMEM  = {14,8,4,2,14,255,255,255,255,255,255,255,255,255,0};
const unsigned char fontThree[] PROGMEM  = {14,8,12,8,14,255,255,255,255,255,255,255,255,255,0};
const unsigned char fontFour[] PROGMEM  = {8,12,10,14,8,255,255,255,255,255,255,255,255,255,0};
const unsigned char fontFive[] PROGMEM  = {14,2,14,8,14,255,255,255,255,255,255,255,255,255,0};
const unsigned char fontSix[] PROGMEM  = {14,2,14,10,14,255,255,255,255,255,255,255,255,255,0};
const unsigned char fontSeven[] PROGMEM  = {14,8,8,8,8,255,255,255,255,255,255,255,255,255,0};
const unsigned char fontEight[] PROGMEM  = {14,10,14,10,14,255,255,255,255,255,255,255,255,255,0};
const unsigned char fontNine[] PROGMEM  = {14,10,14,8,14,255,255,255,255,255,255,255,255,255,0};
const unsigned char Smile[]    PROGMEM =  {255,255,255,36,102,255,255,129,195,102,60,255,255,255,0};
 
const unsigned char *bitmap_table[] PROGMEM = {
  fontZero,  fontOne,  fontTwo,  fontThree,  fontFour,  fontFive,  fontSix,  fontSeven,  fontEight,  fontNine,  Smile};
char buffer[LEDrows];

Whandall

Code: [Select]
const unsigned char* const sentence_table[] PROGMEM = {
...
const unsigned char* const bitmap_table[] PROGMEM = {
...
Ah, this is obviously some strange usage of the word 'safe' that I wasn't previously aware of. (D.Adams)

Raizen1337

Code: [Select]
const unsigned char* const sentence_table[] PROGMEM = {
...
const unsigned char* const bitmap_table[] PROGMEM = {
...

I changed to this and it now compiles without errors.

Is it good now? The pointer?


.....................

After all.. i fixed the #include <Charliplexing.h> -- line with the new Charliplexing library..

Then i followed the instructions and deleted few words from a line (.16)

I also fixed the #include <WProgram.h> in the Charliplexing.h
...

Then thanks to your help i fixed the prog_uchar comamnd with the "const unsigned char"


.....................

I can compile now without erors.

Do you think the sketch/program is full and might work for me?



.....................

Can somebody control it for me please last time? I uploaded here with the new lines:


https://www.sendspace.com/file/1ll9ix

.................
also. if i changed the lines in the code.. do i need to re-do my soldering? From the instructions and project?



THANK YOU VERY MUCH !

UKHeliBob

Quote
I uploaded here with the new lines:
Why not upload it here ?
Please do not send me PMs asking for help.  Post in the forum then everyone will benefit from seeing the questions and answers.

Raizen1337

Why not upload it here ?
I don't know how to upload a file into comments. I don't think there is a option.

Should I attach it to the main post again?
The old one and the new one files have the same name.. isn't it problem? :) Or should i rename it and upload into main post?

//EDIT: Oh and UKHeliBob.. on the 1.page i quoted your comment and asked you something there... can you answer me please? I need to be sure about everything before trying anything. I feel like a total noob.

PaulS

Quote
Or should i rename it and upload into main post?
No. Post new code in a new reply. Use the Reply link, not the Quick Reply field.
The art of getting good answers lies in asking good questions.

Raizen1337

Thank you PaulS !

I got it and i attached/uploaded the sketch. It compiles now without error.

PaulS - I see that you have a lot of replies and you have to be some experienced guy with arduino. Can you please check it for me with fast-eyes if everything is OK?

Error are not popping up so the sketch might be finished.

UKHeliBob

Quote
I just put the LOLSheild on top of the Arduino ... upload the code from the libraby Charlieplexing ... then I need a 9V adapter plugged into the Arduino? That's all ?
For what it's worth, what I did was to plug the LOL shield onto a Uno and power the combination via USB.
Please do not send me PMs asking for help.  Post in the forum then everyone will benefit from seeing the questions and answers.

Go Up