I've tried passing them with and without [] and () and &. I keep getting "exit status 1
'onRelays' was not declared in this scope" pointing at SetRelays(onRelays,offRelays);
Not sure exactly how to achieve this do they need to be declared globally or public or something? I'd rather not because I need to make several other functions using those same arrays but of different sizes.
//List of relays at bottom
int relays[]={0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19}; //Skip 0 [1] threw [19] relays 1-19
int batteryStatus[] = {0,0,0,0,0,0,0,0,0,0,0}; //Skips 0, status 0 = needs charging, 1 = charging, 2 = charged ready to discharge, 3 = discharging 12v, 4 = discharging 24v
void setup() {
for(int i = 1;i<19;i++){
pinMode(relays[i],OUTPUT);
digitalWrite(relays[i],LOW); //Inilitilizes all relays low
}
}
void loop() {
}
void ChargeBattery(int batteryToCharge){
if (batteryToCharge < 6){
int onRelays[] = {0,0};
int offRelays[] = {0,0};
}
else if (batteryToCharge < 11){
int onRelays[] = {0,0};
int offRelays[] = {0,0};
}
batteryToCharge = 14 - batteryToCharge;
SetRelays(onRelays,offRelays);
}
void ZeroRelays(){
for(int i=1;i<20;i++){
digitalWrite(relays[i],LOW);
}
return;
}
void SetRelays(int on[], int off[]){
for(int i = 0; i<sizeof(off) - 1; i++){
digitalWrite(off[i],LOW);
}
delay(50);
for(int i = 0; i<sizeof(on) - 1; i++){
digitalWrite(on[i],HIGH);
}
return;
}