Added function to set pin modes

This commit is contained in:
2025-11-02 14:15:46 +01:00
parent 02a9c782c2
commit 7d31db7fcb
3 changed files with 33 additions and 18 deletions

View File

@@ -17,3 +17,9 @@ bool debounceReadNO(int buttonPin);
* @return false
*/
bool debounceReadNC(int buttonPin);
/**
* @brief Sets all the pins to their correct modes
*
*/
void setPinModes();

View File

@@ -98,4 +98,30 @@ bool debounceReadNC(int buttonPin)
lastButtonStateNC = reading;
}
return buttonPressed;
}
/**
* @brief Sets all the pins to their correct modes
*
*/
void setPinModes()
{
pinMode(LED_HIGH, OUTPUT); // Green
pinMode(LED_MED, OUTPUT); // Red LED (D4)
pinMode(LED_LOW, OUTPUT); // Green LED
pinMode(BTN_STAFF_UP, INPUT); // SW1
pinMode(BTN_STAFF_DWN, INPUT); // SW2
// RF Receiver
pinMode(REMOTE_A, INPUT); // Remote Button A
pinMode(REMOTE_B, INPUT); // Remote Button B
pinMode(REMOTE_C, INPUT); // Remote Button C
pinMode(REMOTE_D, INPUT); // Remote Button D
// Potentiometer
pinMode(POT_CS, OUTPUT); // D10 - CS
pinMode(POT_UD, OUTPUT); // D9 - U/D
digitalWrite(POT_CS, HIGH);
digitalWrite(POT_UD, LOW);
}

View File

@@ -12,24 +12,7 @@ int oldUserVolume = userVolume;
void setup()
{
pinMode(LED_HIGH, OUTPUT); // Green
pinMode(LED_MED, OUTPUT); // Red LED (D4)
pinMode(LED_LOW, OUTPUT); // Green LED
pinMode(BTN_STAFF_UP, INPUT); // SW1
pinMode(BTN_STAFF_DWN, INPUT); // SW2
// RF Receiver
pinMode(REMOTE_A, INPUT); // Remote Button A
pinMode(REMOTE_B, INPUT); // Remote Button B
pinMode(REMOTE_C, INPUT); // Remote Button C
pinMode(REMOTE_D, INPUT); // Remote Button D
// Potentiometer
pinMode(POT_CS, OUTPUT); // D10 - CS
pinMode(POT_UD, OUTPUT); // D9 - U/D
digitalWrite(POT_CS, HIGH);
digitalWrite(POT_UD, LOW);
setPinModes();
// Reset the potentiometer
for (int i = 0; i < 64; i++)