1

Topic: Esp32 fails to connect to wifi

I have written this code for controling few leds. If the loop function is empty, my board connects to my wifi no problem. But somehow it doesn't with my 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 [url]http://remotexy.com/en/library/[/url]
   To connect using RemoteXY mobile app by link [url]http://remotexy.com/en/download/[/url]                   
     - 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_CLOUD

#include <WiFi.h>

// RemoteXY connection settings 
#define REMOTEXY_WIFI_SSID "Interneras"
#define REMOTEXY_WIFI_PASSWORD "urbm2927"
#define REMOTEXY_CLOUD_SERVER "cloud.remotexy.com"
#define REMOTEXY_CLOUD_PORT 6376
#define REMOTEXY_CLOUD_TOKEN "XXXXXXXX"

#include <RemoteXY.h>

// RemoteXY GUI configuration  
#pragma pack(push, 1)  
uint8_t RemoteXY_CONF[] =   // 30 bytes
  { 255,1,0,0,0,23,0,17,0,0,0,24,1,106,200,1,1,1,0,1,
  42,84,24,24,0,94,24,58,68,0 };
  
// this structure defines all the variables and events of your control interface 
struct {

    // input variables
  uint8_t button_01; // =1 if button pressed, else =0

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

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

#include <FastLED.h>

#define NUM_LEDS 59
#define DATA_PIN 3

CRGB leds[NUM_LEDS];
const byte signalas = 2;




void setup() 
{
  RemoteXY_Init (); 
  
     FastLED.addLeds<WS2812B, DATA_PIN, RGB>(leds, NUM_LEDS);  // GRB ordering is typical
     pinMode(signalas, INPUT);
     
  // TODO you setup code

  
}

void loop() 
{ 
  RemoteXY_Handler ();

  if(digitalRead(signalas)==HIGH){

    for(int a = 0; a<=99; a++){
      leds[a] = CRGB(255,255,255);
    }
    FastLED.show();
  }
  else if(RemoteXY.button_01 == 1){

    for(int p=0; p<=99; p++){
      leds[p]=(0,0,0);
    }
    FastLED.show();
    
    leds[30] = CRGB(255,255,255);
    leds[50] = CRGB(255,255,255);
    leds[70] = CRGB(255,255,255);
    leds[90] = CRGB(255,255,255);
    FastLED.show();
    RemoteXY_delay(15);

    leds[11] = CRGB(255,255,255);
    leds[9]  = CRGB(255,255,255);
    leds[31] = CRGB(255,255,255);
    leds[29] = CRGB(255,255,255);
    leds[51] = CRGB(255,255,255);
    leds[49] = CRGB(255,255,255);
    leds[71] = CRGB(255,255,255);
    leds[69] = CRGB(255,255,255);
    FastLED.show();
    RemoteXY_delay(15);

    leds[12] = CRGB(255,255,255);
    leds[8]  = CRGB(255,255,255);
    leds[32] = CRGB(255,255,255);
    leds[28] = CRGB(255,255,255);
    leds[52] = CRGB(255,255,255);
    leds[48] = CRGB(255,255,255);
    leds[72] = CRGB(255,255,255);
    leds[68] = CRGB(255,255,255);
    FastLED.show();
    RemoteXY_delay(15);

    leds[33] = CRGB(255,255,255);
    leds[27] = CRGB(255,255,255);
    leds[53] = CRGB(255,255,255);
    leds[47] = CRGB(255,255,255);
    FastLED.show();
    RemoteXY_delay(1000);

    leds[30] = CRGB(0,0,0);
    leds[50] = CRGB(0,0,0);
    leds[70] = CRGB(0,0,0);
    leds[90] = CRGB(0,0,0);
    leds[11] = CRGB(0,0,0);
    leds[9]  = CRGB(0,0,0);
    leds[31] = CRGB(0,0,0);
    leds[29] = CRGB(0,0,0);
    leds[51] = CRGB(0,0,0);
    leds[49] = CRGB(0,0,0);
    leds[71] = CRGB(0,0,0);
    leds[69] = CRGB(0,0,0);
    leds[12] = CRGB(0,0,0);
    leds[8]  = CRGB(0,0,0);
    leds[32] = CRGB(0,0,0);
    leds[28] = CRGB(0,0,0);
    leds[52] = CRGB(0,0,0);
    leds[48] = CRGB(0,0,0);
    leds[72] = CRGB(0,0,0);
    leds[68] = CRGB(0,0,0);
    leds[33] = CRGB(0,0,0);
    leds[27] = CRGB(0,0,0);
    leds[53] = CRGB(0,0,0);
    leds[47] = CRGB(0,0,0);
    FastLED.show();

    
  }
  else {
    for(int p=0; p<=99; p++){
      leds[p]=(0,0,0);
    }
    FastLED.show();
  }
  
  // TODO you loop code
  // use the RemoteXY structure for data transfer
  // do not call delay(), use instead RemoteXY_delay() 


}