Added function to set pin modes
This commit is contained in:
@@ -17,3 +17,9 @@ bool debounceReadNO(int buttonPin);
|
|||||||
* @return false
|
* @return false
|
||||||
*/
|
*/
|
||||||
bool debounceReadNC(int buttonPin);
|
bool debounceReadNC(int buttonPin);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Sets all the pins to their correct modes
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
void setPinModes();
|
||||||
@@ -99,3 +99,29 @@ bool debounceReadNC(int buttonPin)
|
|||||||
}
|
}
|
||||||
return buttonPressed;
|
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);
|
||||||
|
}
|
||||||
19
src/main.cpp
19
src/main.cpp
@@ -12,24 +12,7 @@ int oldUserVolume = userVolume;
|
|||||||
|
|
||||||
void setup()
|
void setup()
|
||||||
{
|
{
|
||||||
pinMode(LED_HIGH, OUTPUT); // Green
|
setPinModes();
|
||||||
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);
|
|
||||||
|
|
||||||
// Reset the potentiometer
|
// Reset the potentiometer
|
||||||
for (int i = 0; i < 64; i++)
|
for (int i = 0; i < 64; i++)
|
||||||
|
|||||||
Reference in New Issue
Block a user