error: redefinition of ' '

This can also happen if you have saved a version of the code (for example duplicate file for backup) within the current sketch folder.


You have a combination of trying to define the same name twice, for example "gm"

int gm[] = {9362,2,2,2,0};
int bm[] = {4681,1,1,1,0};
int rm[] = {18724,2304,36,2304,18724};
int gm[] = {9362,1152,18,1152,9362};

And using others such "rc2" which you have never defined.

Your code won't compile and work until you make it self-consistent.


The first errors happen because you are trying to define a variable with the same name in the same scope twice, like here:

int gm[] = {9362,2,2,2,0};
int bm[] = {4681,1,1,1,0};
int rm[] = {18724,2304,36,2304,18724};
int gm[] = {9362,1152,18,1152,9362};

gm is defined two times which is not allowed.

The other error happens because you are referencing variables you never declared like here:

if (c == 'rc'){for (int i = 0; i <5; i++){displayLine(rc2[i]);delay(delayTime);}displayLine(0);}

rc2 isn't defined anywhere.


Besides there are some other issues with your code:

int charBreak = 2.1;

int types can only contain whole numbers, so charBreak will be set to two and not two point one. You probably wan't to use a float.

In void displayChar(char c) you try to compare a char with two chars:

if (c == 'ra')

That won't work. The char type can only contain a single character, so the comparison will always be false. Two chars like this 'ab' in single quotes are interpreted as 16 bit number. Two chars in double quotes are interpreted as a null-terminated string:

char cstring1[] = "ab";
char cstring2[] = {'a', 'b', '\0'};

if (strcmp(cstring1, cstring2) == 0)
  // The two strings are identical

strcmp returns 0 on match-.

Tags:

Arduino Uno