Implement Discord mute/deafen status detection and control via serial communication
This commit is contained in:
+31
-1
@@ -1,7 +1,12 @@
|
||||
#define MUTE_PIN 18
|
||||
#define DEAFEN_PIN 19
|
||||
|
||||
void setup()
|
||||
{
|
||||
pinMode(16, INPUT_PULLUP); // D16 for "mute" button
|
||||
pinMode(16, INPUT_PULLUP); // D16 for "mute" button
|
||||
pinMode(17, INPUT_PULLUP); // D17 for "deafen" button
|
||||
pinMode(MUTE_PIN, OUTPUT);
|
||||
pinMode(DEAFEN_PIN, OUTPUT);
|
||||
Serial.begin(115200);
|
||||
}
|
||||
|
||||
@@ -18,4 +23,29 @@ void loop()
|
||||
Serial.println("deafen");
|
||||
delay(200); // Debounce delay
|
||||
}
|
||||
|
||||
if (Serial.available() > 0)
|
||||
{
|
||||
String input = Serial.readStringUntil('\n');
|
||||
if (input == "Mute: True, Deafen: False")
|
||||
{
|
||||
digitalWrite(MUTE_PIN, HIGH);
|
||||
digitalWrite(DEAFEN_PIN, LOW);
|
||||
}
|
||||
else if (input == "Mute: True, Deafen: True")
|
||||
{
|
||||
digitalWrite(MUTE_PIN, HIGH);
|
||||
digitalWrite(DEAFEN_PIN, HIGH);
|
||||
}
|
||||
else if (input == "Mute: False, Deafen: False")
|
||||
{
|
||||
digitalWrite(MUTE_PIN, LOW);
|
||||
digitalWrite(DEAFEN_PIN, LOW);
|
||||
}
|
||||
else if (input == "Mute: False, Deafen: True")
|
||||
{
|
||||
digitalWrite(MUTE_PIN, LOW);
|
||||
digitalWrite(DEAFEN_PIN, HIGH);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user