I would like to define an array so that I could pass that array (of 5 numbers in this instance) to a function that I have defined. For example, I would make the following definition:
int one[5]={2,3,4,5,6}; // 5-number array to pass along
Then inside my loop I would pass this to the function 'myLED()' which I hdefine later:
void loop() {
myLED(one); // pass along the 5 numbers to the function 'myLED()'
}
I would define the function 'myLED()' below:
void myLED(int i,int j,int k, int l,int m) {
pinMode(i,OUTPUT); digitalWrite(i,HIGH);
// and the rest of the function definition using the 5 integers i,j,k,l,m
}
Error messages include things such as
'error: too few arguments to function 'void myLED(int, int, int, int, int)'
and,
' void myLED(int i,int j,int k, int l,int m) {
^
exit status 1
invalid conversion from 'int' to 'int*' [-fpermissive]'
I have tried int and int* and various permutations of the array declaration (e.g. #define ...) but I can't get the syntax right to pass the 5 numbers as a named variable. Any thoughts?