New issue, the if loop control the relay will only run once per for loop.
i.e. it will iterate through the for loop run the if loop once and then wait for the delay to be completed.
for (private i = 0, i < numrows(tempSPs), i++)
curSP = tempSPs[i]
if(Out < 0)
Relay_control[0] = 0
delay(0.02)
else
Relay_control[0] = 1
delay(0.02)
endif
delay(tempDuration[i])
?tempSPs[i]
?tempDuration[i]
endfor
What is required is for the if loop to actually run continuously during the whole delay of the for loop, would this work?
for (private i = 0, i < numrows(tempSPs), i++)
curSP = tempSPs[i]
private startTime = systime()
private elapsedTime = 0
while (elapsedTime < tempDuration[i])
if(Out < 0)
Relay_control[0] = 0
delay(0.02)
else
Relay_control[0] = 1
delay(0.02)
endif
elapsedTime = systime() - startTime
endwhile
delay(tempDuration[i])
?tempSPs[i]
?tempDuration[i]
endfor