Part of a program I wrote for the esp8266 in the Arduino IDE is a function that "translates" a boolean array into an int array and returns the latter. The returned array is then given to a different function as an argument.
translation function:
int translate(bool data[], int nr, bool dir) {
int real_data[48];
real_data[47] = 1000;
if (dir == false) {
data[1] = true;
if (nr == 1) {
data[21] = true;
data[23] = false;
} else if (nr == 2 || nr == 3) {
data[21] = false;
data[23] = true;
} else if (nr == 5 || nr == 6) {
data[21] = false;
data[23] = false;
} else {
data[21] = true;
data[23] = true;
}
}
for (int i = 0; i < 24; i++) {
if (data[i] == true) {
real_data[i * 2] = 1300;
if (i < 23) {
real_data[(i * 2) + 1] = 400;
}
} else {
real_data[i * 2] = 400;
if (i < 23) {
real_data[(i * 2) + 1] = 1300;
}
}
}
return real_data;
}
function that uses the translated array:
void sendIr(int data[]) {
digitalWrite(LED_BUILTIN, HIGH);
//irsend.sendRaw(data ,48,36); not important for now, doesn't change the result
digitalWrite(LED_BUILTIN, LOW);
}
line that calls the functions (there are multiple but they are all like this)("r3" is a boolean array):
sendIr(translate(r3, 5, false));
When compiling I get the following error:
invalid conversion from 'int' to 'int*' [-fpermissive]for the lines
return real_data;void sendIr(int data[]) {and the lines that call the functions.
I am very confused why I get this error mainly because I never use pointers.
But it gets even weirder because when I select an Arduino board (uno, nano, ...) in the IDE and try to compile it I get no error. Do I need a library or anything else to make this work on the esp8266? All the examples for the esp8266 I tried out worked perfectly so I'm pretty sure I installed the esp stuff correctly.
Any ideas on what the issue could be and how to fix it? Thanks