I'm trying to use a function to generate an array. Below is a stripped down version of my code. In the loop, the variable named "pattern" should get an array of numbers from the function generatePattern(). Thanks for any help.
int pattern_local[] = {1, 2};
int pattern[] = {3, 4};
void setup()
{
Serial.begin(9600);
}
void loop()
{
pattern = generatePattern();
}
int generatePattern()
{
int pattern_local[] = {1, 2};
return pattern_local;
}
This errors out with:
In function 'void loop()':
error: incompatible types in assignment of 'int' to 'int [2]' In function 'int generatePattern()':
Can anyone point me in the right direction?