I'm wondering how to create a function that takes in some of its arguments by reference.
I have this function...
void handleBtn_On_Off(unsigned char inputPinNumber, long &lastStateChange, bool &stateOfBtn,int DebounceTime ,bool btnHasOutput, unsigned char outputPin) {
int pauseBtnReading = digitalRead(inputPinNumber);
if (pauseBtnReading == 1) {
long currentMillis = millis();
if (currentMillis - lastStateChange > DebounceTime) {
stateOfBtn = !stateOfBtn;
if (btnHasOutput) {
digitalWrite(outputPin, pauseIsActive);
};
lastStateChange = currentMillis;
};
};
}; // end handlePause
where I would invoke it like this...
handleBtn_On_Off(digitalInputPins[0], lastStateChangePause, pauseIsActive, 399, true, 8); // pause btn