i'm making a project and i came across the follwing error. Whan i'm trying to compile and upload the code i'm getting those errors:
ShiftRegisterTest1.ino:In function 'int* return_pins(int)'
displays.ino:9: error: expected primary-expression before '{' token
displays.ino:9: error: expected `;' before '{' token
displays.ino:12: error: expected primary-expression before '{' token
displays.ino:12: error: expected `;' before '{' token
displays.ino:15: error: expected primary-expression before '{' token
displays.ino:15: error: expected `;' before '{' token
displays.ino:18: error: expected primary-expression before '{' token
displays.ino:18: error: expected `;' before '{' token
displays.ino:21: error: expected primary-expression before '{' token
displays.ino:21: error: expected `;' before '{' token
displays.ino:24: error: expected primary-expression before '{' token
displays.ino:24: error: expected `;' before '{' token
displays.ino:27: error: expected primary-expression before '{' token
displays.ino:27: error: expected `;' before '{' token
displays.ino:30: error: expected primary-expression before '{' token
displays.ino:30: error: expected `;' before '{' token
displays.ino:33: error: expected primary-expression before '{' token
displays.ino:33: error: expected `;' before '{' token
displays.ino:36: error: expected primary-expression before '{' token
displays.ino:36: error: expected `;' before '{' token
displays.ino:39: error: expected primary-expression before '{' token
displays.ino:39: error: expected `;' before '{' token
displays.ino:42: error: expected primary-expression before '{' token
displays.ino:42: error: expected `;' before '{' token
displays.ino:45: error: expected primary-expression before '{' token
displays.ino:45: error: expected `;' before '{' token
displays.ino:48: error: expected primary-expression before '{' token
displays.ino:48: error: expected `;' before '{' token
displays.ino:51: error: expected primary-expression before '{' token
displays.ino:51: error: expected `;' before '{' token
displays.ino:56: error: expected primary-expression before '{' token
displays.ino:56: error: expected `;' before '{' token
Error compiling
I don't really understand why since the code (see below) should be working.
int * return_pins(int get_number)
{
static int rp[8];
switch(get_number)
{
//DP, A, B, C, D, E, F, G
case 48: //0
rp[8] = {0, 1, 1, 1, 1, 1, 1, 0};
break;
case 49: //1
rp[8] = {0, 0, 1, 1, 0, 0, 0, 0};
break;
case 50: //2
rp[8] = {0, 1, 1, 0, 1, 1, 0, 1};
break;
case 51: //3
rp[8] = {0, 1, 1, 1, 1, 0, 0, 1};
break;
case 52: //4
rp[8] = {0, 0, 1, 1, 0, 0, 1, 1};
break;
case 53: //5
rp[8] = {0, 1, 0, 1, 1, 0, 1, 1};
break;
case 54: //6
rp[8] = {0, 1, 0, 1, 1, 0, 1, 1};
break;
case 55: //7
rp[8] = {0, 1, 1, 1, 0, 0, 0, 0};
break;
case 56: //8
rp[8] = {0, 1, 1, 1, 1, 1, 1, 1};
break;
case 57: //9
rp[8] = {0, 1, 1, 1, 1, 0, 1, 1};
break;
case 65: //A
rp[8] = {0, 1, 1, 1, 0, 1, 1, 1};
break;
case 70: //F
rp[8] = {0, 1, 0, 0, 0, 1, 1, 1};
break;
case 69: //E
rp[8] = {0, 1, 0, 0, 1, 1, 1, 1};
break;
case 80: //P
rp[8] = {0, 1, 1, 0, 0, 1, 1, 1};
break;
case 72: //H
rp[8] = {0, 0, 1, 1, 0, 1, 1, 0};
break;
//DP, A, B, C, D, E, F, G
case 45: //-
default:
rp[8] = {0, 0, 0, 0, 0, 0, 0, 1};
break;
}
return rp;
}
What this code does is to basicaly get an int
ad input and based on this number it returns an int array
. It's a very simple code which is called inside the loop()
method which is located on an other file.
Also i'm using Atmel Studio 6 instead of the original Arduino IDE but i dont think it has to do something with the problem :/