Skip to content

Commit

Permalink
Use SoftwareSerial
Browse files Browse the repository at this point in the history
  • Loading branch information
probonopd authored Jul 30, 2023
1 parent 76214ec commit 1057c79
Showing 1 changed file with 14 additions and 7 deletions.
21 changes: 14 additions & 7 deletions examples/MuteUnmuteExample/MuteUnmuteExample.ino
Original file line number Diff line number Diff line change
@@ -1,17 +1,24 @@
#include <TAPController.h>
#include <SoftwareSerial.h>
#include "TAPController.h"

TAPController tap(Serial);
// Define SoftwareSerial object with RX and TX pins
// Use pin 2 for RX (receive) and pin 3 for TX (transmit) for TAP communication
SoftwareSerial tapSerial(2, 3);

void setup() {
Serial.begin(4800); // Start serial communication
Serial.begin(115200); // Initialize normal serial communication at 115200 baud for debugging
tapSerial.begin(4800); // Set the baud rate to 4800 for SoftwareSerial communication
delay(1000); // Wait for the TAPController to initialize
}

void loop() {
// Mute the audio
tap.muteAudio();
delay(5000); // Sleep for 5 seconds
tapController.muteAudio();
Serial.println("Audio muted");
delay(3000); // Wait for 3 seconds

// Unmute the audio
tap.unmuteAudio();
delay(5000); // Sleep for 5 seconds
tapController.unmuteAudio();
Serial.println("Audio unmuted");
delay(3000); // Wait for 3 seconds
}

0 comments on commit 1057c79

Please sign in to comment.