DF PLAYER with OneWireKeypad trigger issue

Ya issue is with that board seems like . . . . .

Well with this swap call same condition

Now I am switching to a new board I got today . . .

Lets see

I have this one (eh, close to what I have), which is quite different from yours even though it’s a ESP8266 too.

O I see that is another board
D1 mini

Have to search on Amazon etc

Would it work better ??

or should I switch to ESP 32 ??

I have one free for now . . . should I make connections on that ??

Do you have just a regular Arduino Uno or Mega?

Ya ya UNO and MEGA not I have but for now I have UNO ready . .

On second ESP 8266 keypad is not working any of the way
Atleast on first one it was running !!!

Ok so use the UNO then for that use software serial on pins 10 & 11

You only need one resistor.

kit_m87_mp3_1

Ya I started very first experiment in that manner only

Ok whats next after this ?

Does it work?

Yes yes all the way . . .I added so many other functions like different track play buttons stop button etc

Great! Now what comes next is up to you. Add the keypad back in and try to get it to work with the DFPlayer module.

OK You mean the complete setup as it is but with Arduino UNO model MCU ??

If you can.

You know it works with the UNO, if you want to go back and try the ESP8266 go for it. You probably won’t have the use of the Serial Monitor but if it works then that’s good.

OK I am thinking for ESP 32 actually

What's your suggestion
Is it a good choice or should I start it with UNO only

Please tell

OK its better to move ahead with UNO only !!

No change

Same thing is going on with UNO also

Moved ahead for ESP 32 and the connections are ready

here in place of A0 for UNO and ESP8266, how should I mention this

OnewireKeypad <Print, 16 > Keypad(Serial, KEYS, 4, 4, A0, 4700, 1000);

I have ESp32 WROOM 38 PIN module

Please guide !!

What do you mean no change? What is not working now?

Same results are coming out of the system

I mean the issues regarding the code and the requirements discussed in this post earlier

From post #4

boolean stone = 0; // flag to keep from replaying during "button held"
boolean soup = 0;

Inside "if keypad...state 3" (press-and-hold), check keypress...

    if(keypress=='1') 
    {

Then check for the flag...

      if (stone == 0) { // false = not yet played
        player1.loop(14); // play the file 
        stone = 1; // set the flag to true = played / do not play again
      } // close stone
    } // close keypress "1"

    if(keypress=='2')
    {
      if (soup == 0) {
        player1.loop(15);
        soup = 1;
      }
    }
  stone = 0; // reset flag when outside the key press scope
  soup = 0; // reset flag

Show your full code

here . . .

#include "OnewireKeypad.h" // OneWireKeypad Library

boolean stone = 0; // flag to keep from replaying during "button held"
boolean soup = 0;
boolean gem = 0;

char KEYS[] =   // Define keys' values of Keypad
{
	'1', '2', '3', 'A',
	'4', '5', '6', 'B',
	'7', '8', '9', 'C',
	'*', '0', '#', 'D'
};

/* Define Library :
OnewireKeypad <Print, #of buttons>
Keypad(Serial, Char values, #Rows, #Cols, Arduino Pin, Row_resistor, Columns_resistor) */
OnewireKeypad <Print, 16 > Keypad(Serial, KEYS, 4, 4, A0, 4700, 1000);
int ledpin = 2;

#include <DFPlayerMini_Fast.h>
#include <SoftwareSerial.h>
SoftwareSerial mySerial2(10, 11); // RX, TX
DFPlayerMini_Fast player2;

void setup ()
{
	Serial.begin(9600);
  // Serial.swap();
  pinMode(ledpin, OUTPUT);
  mySerial2.begin(9600);
   if(player2.begin(mySerial2, false))
  {
  player2.volume(12);
  player2.play(2);
  }
}

void loop()
{
	Keypad.SetHoldTime(50);  // Key held time in ms
	Keypad.SetDebounceTime(25); // Key Debounce time in ms
	if ((Keypad.Key_State() == 3))    // not pressed = 0, pressed = 1, released = 2,  held = 3
	{
		char keypress = Keypad.Getkey();  // put value of key pressed in variable 'keypress'
		Serial.print("Keypad Key: ");
		Serial.println(keypress);  // Display value on Serial Monitor
		// while ((Keypad.Key_State())) {} // Stay here while Key is held down

    if(keypress=='1') 
    {
      if (stone == 0) { // false = not yet played
        player2.loop(14); // play the file 
        stone = 1; // set the flag to true = played / do not play again
      } // close stone
    } // close keypress "1"

    if(keypress=='2')
    {
      if (soup == 0) {
        player2.loop(15);
        soup = 1;
      }
    }

    if(keypress=='A')
    {
      if (gem == 0) {
      player2.stop();
      gem = 1;
      }
    }

    stone = 0; // reset flag when outside the key press scope
    soup = 0; // reset flag
    gem = 0;

  }
}