Muhammad_Munir
Published © GPL3+

Ring Loop Game by using Arduino

How to make Ring Loop Game by using Arduino and DF Player Mini

BeginnerFull instructions provided475
Ring Loop Game by using Arduino

Things used in this project

Hardware components

Arduino Nano R3
Arduino Nano R3
×1
Df player mini
×1
3.7volt battery
×1
SD Card
×1
3 watt Speaker
×1
Jumper wire
×1
10 k Resistors
×2
1 k Resistors
×1
Hard metal wire
×1
Card Board
×1

Story

Read more

Schematics

Diagram

Code

Code

Arduino
#include "SoftwareSerial.h"
#include "DFRobotDFPlayerMini.h"

// Use pins 2 and 3 to communicate with DFPlayer Mini
static const uint8_t PIN_MP3_TX = 2; // Connects to module's RX 
static const uint8_t PIN_MP3_RX = 3; // Connects to module's TX 
SoftwareSerial softwareSerial(PIN_MP3_RX, PIN_MP3_TX);

const int wirePin = 4; 
const int endPin = 5; 

// Create the Player object
DFRobotDFPlayerMini player;

void setup() {

pinMode(wirePin, INPUT);
pinMode(endPin, INPUT);

  // Init USB serial port for debugging
  Serial.begin(9600);
  // Init serial port for DFPlayer Mini
  softwareSerial.begin(9600);

  // Start communication with DFPlayer Mini
  if (player.begin(softwareSerial)) {
   Serial.println("OK");

    // Set volume to maximum (0 to 30).
    player.volume(30);
    // Play the first MP3 file on the SD card
    player.play(1);
  } else {
    Serial.println("Connecting to DFPlayer Mini failed!");
  }
}

void loop() {

   if (digitalRead(wirePin) == HIGH) {
     player.play(2);
     delay(5000);

   }
    if (digitalRead(endPin) == HIGH) {
       player.play(3);
       delay(5000);

    }
   }

Credits

Muhammad_Munir
79 projects • 55 followers
I am Arduino programmer, also expertise in ESP32 and 8266 wifi modules.

Comments