Program uploaded in arduino uno runs but in esp8266 not run

i had done program for rummy card dealer which can distributes rummy card according to no of players and no of cards

i am using A4988,keypad,16x2 lcd and DC motor when i run it in arduino uno that runs fine but if i run it in esp32 or esp8266 it not run instead of run it returns Watchdog timer error

v00043350
~ld
����o�{��o<�$ �l b�e�<s�l�o��o�l��r�$�d� �
ets Jan 8 2013,rst cause:4, boot mode:(3,6)

wdt reset
load 0x4010f000, len 3424, room 16
tail 0
chksum 0x2e
load 0x3fff20b8, len 40, room 8
tail 0
chksum 0x2b
csum 0x2b
v00043350
~ld

please answer anybody knows how can solve it


//Programa: Display LCD 16x2 e modulo I2C
//Autor: Arduino e Cia

#include <Wire.h>
#include <LiquidCrystal_I2C.h>
#include <Keypad.h>
int player[2];
int numcard[2];
char key,ke;
int i=0;
int c;
int a;
int x=0;
int z=0,y=0;
const byte ROW_NUM = 4;
const byte COLUMN_NUM = 4;
const int steppin=3;
const int dirpin=2;
char keys[ROW_NUM][COLUMN_NUM] = {
  {'1', '2', '3', 'A'},
  {'4', '5', '6', 'B'},
  {'7', '8', '9', 'C'},
  {'*', '0', '#', 'D'}
};

byte pin_rows[ROW_NUM] = {6, 7, 8, 9};
byte pin_column[COLUMN_NUM] = {10, 11, 12, 13};
Keypad myKeypad = Keypad(makeKeymap(keys), pin_rows, pin_column, ROW_NUM, COLUMN_NUM);
// instancias
LiquidCrystal_I2C lcd(0x27, 16, 2);
//===================================================================================================
void cl()
{
   if(key=='C'&&i<=3)
    {
      for(int f=0;f<2;f++)
      {
        player[f]=0;
        numcard[f]=0;
        i=0;
        x=0;
        lcd.setCursor(0,1);
        lcd.print("            ");
        Serial.print("Player,i=0");
      }
    }
      else if(ke=='C'&&x<=3&&i<4)
      {
        for(int g=0;g<2;g++)
        {
          numcard[g]=0;
          //i=0;
          x=0;
          lcd.setCursor(0,1);
          lcd.print("           ");
          Serial.print("Card,x=0");
        }
      }
}
void clean()
{
y=0;
z=0;
i=0;
x=0;
lcd.init();
lcd.clear();
}
void setup()
{
  
  Serial.begin(9600);
  lcd.init();
  lcd.setBacklight(HIGH);
 /* lcd.setCursor(0,0);   
  lcd.print("Enter Number:");*/
  pinMode(steppin,OUTPUT);
  pinMode(dirpin,OUTPUT);
  pinMode(4,OUTPUT);
  lcd.setCursor(0,0);   
  lcd.print("No of Players:");
}


void loop() {
// lcd.setCursor(0,0);   
//lcd.print("No of Players:");
 key = myKeypad.getKey();
  if (key) {
   if(key=='C')
   {
    cl();
    Serial.println("KEY");
   }

   /* {
      for(int f=0;f<2;f++)
      {
        player[f]=0;
        numcard[f]=0;
      }
    }
      else if(key=='C'&&x<2&&i==2)
      {
        for(int g=0;g<2;g++)
        {
          numcard[g]=0;
        }
      }*/
   else if(key=='A'||key=='B'||key=='D')
    {
      lcd.setCursor(0,1);
      lcd.print("INVALID");
      clean();
      }   
   else if(key=='#')
      {
      lcd.init();
      lcd.clear();
      lcd.setCursor(0,0);
      lcd.print("No of cards");
      while(x<2){
       ke=myKeypad.getKey();
       if(isDigit(ke)){
        lcd.setCursor(0,1);
        lcd.print(ke);
      numcard[x]=ke;
      x++;
      Serial.println(x);
      if(x==2)
      {
        lcd.setCursor(0,1);
        a=(numcard[0]-'0')*10+numcard[1]-'0';
        lcd.print(a);
        Serial.println("Cardarray");
      }
      }
       else if(ke=='C')
      {
        cl();
        Serial.println("CARD");
      }
    else if(ke=='A'||key=='B'||key=='D')
    {
      lcd.setCursor(0,1);
      lcd.print("INVALID");
      clean();
      lcd.setCursor(0,0);
      lcd.print("No of Players:");
      }   
      }
      }
    else if(key=='*')
    {  
      motor(c,a);
    }
    else if(isDigit(key))
    {
      lcd.setCursor(0, 1);
      lcd.print(key);
      player[i]=key;
    i++; 
    Serial.println(i);
 }
      if(i==2)
      {
        //lcd.clear();
        lcd.setCursor(0,1);
        c=(player[0]-'0')*10+player[1]-'0';
        lcd.print(c);
       // delay(1000);
        i++;
        Serial.println("Playerarray");
    }
  } 
  }



void motor(int per,int card)
{
  //int per;
  //int card;
  int ang=360/per;
  int pulse=ang/1.8;
  lcd.clear();
  lcd.setCursor(0,0);
  lcd.print("PROCESSING");
  for(y=0;y<per*card;y++){
    for(z=0;z<pulse;z++)
  {
     digitalWrite(dirpin,LOW);
    digitalWrite(steppin, HIGH);
    delayMicroseconds(550);
    digitalWrite(steppin,LOW);
    delayMicroseconds(550);
    
    //digitalWrite(4, LOW);

  }
  start();
   } 
digitalWrite(4,LOW);
y=0;
z=0;
i=0;
x=0;
lcd.clear();
lcd.setCursor(0,0);
lcd.print("No of Players:");
}
void stop(){
  delay(300);
  digitalWrite(4,LOW);
}
void start(){
  delay(1000);
digitalWrite(steppin, LOW);
digitalWrite(4,  HIGH);
delay(350);
digitalWrite(4,  LOW);
 delay(550);
}

It does not sound like you have a problem with an Arduino Nano ESP32 and hence your topic has been moved to a more suitable location on the forum.

Sounds like your program is running into the ESP8266's watchdog. If your loop function is taking more than a few seconds to complete, you'll have to call yield(); yourself to keep the watchdog from barking.

But when I run it with Arduino uno I just uploaded this code it runs fine without calling yield(). for esp board I just yield() that's ok?

Yes. And the slightest research on your part would have revealed why that is.

Google yield esp8266.

Read.

Think.

Learn.

i happy to say this thank you for your valueable time, i feared out the issue i put just in keypad pin section Add D before pin number like
instead of (wrong for esp series board)
byte pin_rows[ROW_NUM] = {6, 7, 8, 9};
byte pin_column[COLUMN_NUM] = {10, 11, 12, 13};

correct for (esp series board)
byte pin_rows[ROW_NUM] = {D0, D1, D2, D3};
byte pin_column[COLUMN_NUM] = {D4, D5, D6, D7};