ESP8266 recognization with smartphone

Hello. I have a problem with my project. I have two types of codes. My smartphone can't recognise ESP8266 when I upload the first code. But in the second case, my smartphone knows easily ESP8266. can anyone guide me that what is the problem of first code?
this is the first code:

/* include library */
#include <ESP8266WiFi.h>
#include <ESP8266WebServer.h>
WiFiClient client;

/* defining server prt */
ESP8266WebServer server(80);

/* Define WiFi Credentials */
const char* ssid = "hash";/* Your SSID */
const char* password = "12345678";/* Your Password*/

String data="";
int robotspeed = 1023;

/* Defining right and left motor pins */
int RMotor_1 = 0;
int RMotor_2 = 2;
int LMotor_1 = 13;
int LMotor_2 = 15;

/* Defining L298N enable pins */
int REnable = 14;
int LEnable = 12;


void setup() {
Serial.begin(115200);
Serial.println("GPIO test!");

/* Initialize Motor Control Pins as Output */
pinMode(RMotor_1, OUTPUT);
pinMode(RMotor_2, OUTPUT);
pinMode(LMotor_1, OUTPUT);
pinMode(LMotor_2, OUTPUT);

/* Initialize Motor Enable Pins as Output */
pinMode(REnable, OUTPUT);
pinMode(LEnable, OUTPUT);

/*connecting to WiFi */
server.begin();
Serial.println("server started");
}

/* Move Forward */
void move_forward() {
  digitalWrite(RMotor_1,LOW);
  digitalWrite(RMotor_2,HIGH);
  digitalWrite(LMotor_1,HIGH);
  digitalWrite(LMotor_2,LOW);
}

/* Move Backward */
void move_backward() {
  digitalWrite(RMotor_1,HIGH);
  digitalWrite(RMotor_2,LOW);
  digitalWrite(LMotor_1,LOW);
  digitalWrite(LMotor_2,HIGH);
}

/* Move Right */
void turn_right() {
  digitalWrite(RMotor_1,LOW);
  digitalWrite(RMotor_2,HIGH);
  digitalWrite(LMotor_1,LOW);
  digitalWrite(LMotor_2,HIGH);
}

/* Move Left */
void turn_left() {
  digitalWrite(RMotor_1,HIGH);
  digitalWrite(RMotor_2,LOW);
  digitalWrite(LMotor_1,HIGH);
  digitalWrite(LMotor_2,LOW);
}

/* Stop Move */
void move_stop() {
  digitalWrite(RMotor_1,LOW);
  digitalWrite(RMotor_2,LOW);
  digitalWrite(LMotor_1,LOW);
  digitalWrite(LMotor_2,LOW);
}

void loop() {
analogWrite(REnable, robotspeed);
analogWrite(LEnable, robotspeed);

/* Handling Request */
server.handleClient();
String data = server.arg("Key");
Serial.println(data);

/* Setting Speed */
if (server.hasArg("Speed")) {
  int _speed = (server.arg("Speed").toInt());
  robotspeed = _speed;
  Serial.println(robotspeed);
}

if (data == "F") {
  move_forward(); /* If data B moves forward */
}
else if (data == "B") {
  move_backward(); /* If data B moves Backward */
}

else if (data == "R") {
  turn_right(); /* If data B moves Right */
}

else if (data == "L") {
  turn_left(); /* If data B moves Left */
}

else if (data == "S") {
  move_stop(); /* If data B moves Bstop moving */
}

}

void handleRequest() {
  if (server.hasArg("Key")) {
    Serial.println(server.arg("Key"));
  }
  if (server.hasArg("Speed")) {
    Serial.println(server.arg("Speed"));
  }
  server.send(200,"text/html","");
  delay(1);
}

void connectingToWiFi() {
  delay(3000);
  WiFi.disconnect();
  delay(1000);
  Serial.println("Connecting to WiFi");
  WiFi.begin(ssid, password);
  while ((!(WiFi.status() == WL_CONNECTED))) {
    delay(1000);
    Serial.print("...");
  }
  Serial.println("Connected");
  Serial.println("Local IP is : ");
  Serial.print((WiFi.localIP().toString()));
  delay(5000);
}


and this is the second code:

/*
   -- New project --
   
   This source code of graphical user interface 
   has been generated automatically by RemoteXY editor.
   To compile this code using RemoteXY library 3.1.13 or later version 
   download by link http://remotexy.com/en/library/
   To connect using RemoteXY mobile app by link http://remotexy.com/en/download/                   
     - for ANDROID 4.13.13 or later version;
     - for iOS 1.10.3 or later version;
    
   This source code is free software; you can redistribute it and/or
   modify it under the terms of the GNU Lesser General Public
   License as published by the Free Software Foundation; either
   version 2.1 of the License, or (at your option) any later version.    
*/

//////////////////////////////////////////////
//        RemoteXY include library          //
//////////////////////////////////////////////

// you can enable debug logging to Serial at 115200
//#define REMOTEXY__DEBUGLOG    

// RemoteXY select connection mode and include library 
#define REMOTEXY_MODE__WIFI_POINT

#include <ESP8266WiFi.h>

// RemoteXY connection settings 
#define REMOTEXY_WIFI_SSID "RemoteXY"
#define REMOTEXY_WIFI_PASSWORD "12345678"
#define REMOTEXY_SERVER_PORT 6377


#include <RemoteXY.h>

// RemoteXY GUI configuration  
#pragma pack(push, 1)  
uint8_t RemoteXY_CONF[] =   // 28 bytes
  { 255,2,0,0,0,21,0,17,0,0,0,31,1,106,200,1,1,1,0,5,
  21,58,60,60,0,2,26,31 };
  
// this structure defines all the variables and events of your control interface 
struct {

    // input variables
  int8_t joystick_01_x; // from -100 to 100
  int8_t joystick_01_y; // from -100 to 100

    // other variable
  uint8_t connect_flag;  // =1 if wire connected, else =0

} RemoteXY;   
#pragma pack(pop)
 
/////////////////////////////////////////////
//           END RemoteXY include          //
/////////////////////////////////////////////



void setup() 
{
  RemoteXY_Init (); 
}

void loop() 
{ 
  RemoteXY_Handler ();
}

This sounds very much like a duplicate of your other topic

Please explain why you started a second topic when the original one has 40 replies ?

1 Like

I did not get any results from them

This Topic has been locked as it is the identical or too similar your other topic.

Please do not duplicate your questions as doing so wastes the time and effort of the volunteers trying to help you as they are then answering the same thing in different places.

Please create one topic only for your question and choose the forum category carefully. If you have multiple questions about the same project then please ask your questions in the one topic as the answers to one question provide useful context for the others, and also you won’t have to keep explaining your project repeatedly.

Repeated duplicate posting could result in a temporary or permanent ban from the forum.

Could you take a few moments to Learn How To Use The Forum

It will help you get the best out of the forum in the future.

Thank you.

1 Like