#include DFRobotDFPlayerMini.h
#include SoftwareSerial.h
// Define the pin connected to the limit switch
const int limitSwitchPin = 14;
int switchState = 0; // Variable to store the switch state
int lastSwitchState = 1; // Assume Initially the door is closed
// Initialize the software serial connection to the DFPlayer
SoftwareSerial mySoftwareSerial(26, 27); // RX, TX
DFRobotDFPlayerMini myDFPlayer;
void setup() {
// Initialize the limit switch pin as an input with internal pull-up resistor
pinMode(limitSwitchPin, INPUT_PULLUP);
// Start serial communication for debugging
Serial.begin(115200);
// Start software serial communication with the DFPlayer
mySoftwareSerial.begin(9600);