error in processing the code via esp8266 although its being compiled by ide

i have been using esp8266 for a light dimming project via firebase and i ave aldredy coded the program and complied it by arduino ide but then also there is an error while running the esp that is in sreial monitor it shows errors so i have bin used to find by the esp expation decoder and found the error but the language cant be understood by me please i request to have a hint regarding these issue i have been attached the code and the error please check it out …

these is the error

Decoding 4 results are :

  1. 0x40202511: setup at C:\Users\Asus\Documents\Arduino\robov2/robov2.ino line 43 (discriminator 1)
  2. 0x40207900: loop_wrapper at

C:\Users\Asus\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.3.0\cores\esp8266/
core_esp8266_main.cpp line 56

  1. 0x40100718: cont_norm at C:\Users\Asus\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.3.0\cores\esp8266/ cont.S line 109

robov2.ino (2.73 KB)

place your code within the post using code tags - see how to use this forum

if I comment out the multiple loops()

 for (int a = led1 ; led1 <= 255 ; a++)
  {
    pinMode(led1, OUTPUT);
  }

I can connect to my WiFi network

if I don’t comment out the loops I get a watchdog timer reset - in long loops you need to clear the WDT

  ESP.wdtFeed();

do you require the loops ? they appear to be executing the same pinMode() statement multiple times

dear friend please can you clarify by a simple language so that i can understand

if I run the following setup() with the for() loops commented out

void setup()
{
  Serial.begin(115200);
  delay(1000);
   {
    WiFi.softAPdisconnect(true);
    WiFi.disconnect(true);
}

// LOOPS COMMENTED OUT
  /*for (int a = led1 ; led1 <= 255 ; a++)
  {
    pinMode(led1, OUTPUT);
  }
  for (int b = led1 ; led2 <= 255 ; b++)
  {
    pinMode(led2, OUTPUT);
  }
  for (int c = led1 ; led3 <= 255 ; c++)
  {
    pinMode(led3, OUTPUT);
  }
  for (int d = led1 ; led4 <= 255 ; d++)
  {
    pinMode(led4, OUTPUT);
  }
  for (int e = led1 ; led5 <= 255 ; e++)
  {
    pinMode(led5, OUTPUT);
  }
  for (int f = led1 ; led6 <= 255 ; f++)
  {
    pinMode(led6, OUTPUT);
  }*/


  WiFi.begin(WIFI_SSID, WIFI_PASSWORD);
  Serial.print("connecting");
  while (WiFi.status() != WL_CONNECTED) {
    Serial.print(".");
    delay(500);
  }
  Serial.println();
  Serial.print("connected:");
  Serial.println(WiFi.localIP());

//  Firebase.begin(FIREBASE_HOST, FIREBASE_AUTH);
}

I get connection to WiFi

connecting............
connected:192.168.1.94

if I run with the loops in I get a watchdog timer reset

Soft WDT reset

ctx: cont 
sp: 3ffefa20 end: 3ffefc10 offset: 01b0

>>>stack>>>
3ffefbd0:  40201356 00000000 000003e8 402013ec  
3ffefbe0:  feefeffe 00000000 3ffee988 40202070  
3ffefbf0:  feefeffe feefeffe 3ffeebd8 4020280c  
3ffefc00:  feefeffe feefeffe 3ffeebf0 40100710  
<<<stack<<<

 ets Jan  8 2013,rst cause:2, boot mode:(3,6)

load 0x4010f000, len 1384, room 16 
tail 8
chksum 0x2d
csum 0x2d
v4ceabea9
~ld

Soft WDT reset

what are the for() loops doing?
they will loop forever as led1 <= 255 etc is always true

do you wish to set the pins output?

 pinMode(led1, OUTPUT);
    pinMode(led2, OUTPUT);
    pinMode(led3, OUTPUT);
    pinMode(led4, OUTPUT);
    pinMode(led5, OUTPUT);
    pinMode(led6, OUTPUT);

what ESP8266 board are you using?
this may help esp8266-pinout-reference

for (int a = led1 ; led1 <= 255 ; a++)
  {
    pinMode(led1, OUTPUT);
  }

this code does the following:

start variable a with value of led1 increment variable a
as long as value of led1 is smaller than or equal to 255

led1 is a constant with value 12

the condition inside a for-loop says go on looping as long as condition is true
the condition led1 <= 255 is always true. because led1 has the constant value 12

12 <= 255

a = 0 condition 12 <= 255 is true go on looping
a = 1 condition 12 <= 255 is true go on looping
a = 2 condition 12 <= 255 is true go on looping
a = 3 condition 12 <= 255 is true go on looping

a= 32767 condition 12 <= 255 is true go on looping

rollover of value inside variable a
a = 0 condition 12 <= 255 is true go on looping
a = 1 condition 12 <= 255 is true go on looping
… … … until watchdogtimer causes a reset of your ESP8266-board

Your ESP8266 only a small number of IO-pins
Your loop

  for (int a = led1 ; led1 <= 255 ; a++)
  {
    pinMode(led1, OUTPUT);
  }

keeps repeating
pinMode(12, OUTPUT);
pinMode(12, OUTPUT);
pinMode(12, OUTPUT);
pinMode(12, OUTPUT);
pinMode(12, OUTPUT);
pinMode(12, OUTPUT);
pinMode(12, OUTPUT);

which makes no sense at all.

So please describe in normal words
what do want the ESP8266 to do.

best regards Stefan

for (int a = led1 ; led1 <= 255 ; a++)
  {
    pinMode(led1, OUTPUT);
  }

This whole statement is just wrong, led1 has a value, it is assigned to ‘a’ but the condition for exiting the for loop is ‘led1 <= 255’ , if it was true initially it will stay true, causing an infinite loop, which causes a wdt reset after 2.5 secs. I am not quite sure what the purpose of this loop is, but it would not be part of ‘any’ functional program. And yeah, what board are you using ? How many pins does it have, and what do you want them to do ?

dear friends , these is whole thing i want to do:

  1. first sending the variables that is ranging from 0 to 255.

  2. i want to get a variable value form firebase that ranges from 0 to 255; that is sending analog data to firebase and get data from it.

  3. then processing or putting the received data from fire base to a" esp8266nodemcu " micro controller board
    that has about 11 gpio pins.

  4. so that i can control the rgb leds individually; that is changing the analog values via internet and getting it to the board and changing the intensity of each rgb lights so that i can get whole spectrum of light .

this all about the project.

and i have coded the things as required , but because of some errors of the loops i cant do it .
so please tell me what i can do regrading these or any other alternative in coding part so that i can solve all these problem.
thanks for all your efforts

if do a web search for arduino control rgb leds you will find plenty of links

If you would have posted your sketch within </> code tags i would not have to dowwnload it to have a look but lets’ start with changing

  for (int a = led1 ; led1 <= 255 ; a++)
  {
    pinMode(led1, OUTPUT);
  }
  for (int b = led1 ; led2 <= 255 ; b++)
  {
    pinMode(led2, OUTPUT);
  }
  for (int c = led1 ; led3 <= 255 ; c++)
  {
    pinMode(led3, OUTPUT);
  }
  for (int d = led1 ; led4 <= 255 ; d++)
  {
    pinMode(led4, OUTPUT);
  }
  for (int e = led1 ; led5 <= 255 ; e++)
  {
    pinMode(led5, OUTPUT);
  }
  for (int f = led1 ; led6 <= 255 ; f++)
  {
    pinMode(led6, OUTPUT);
  }

to simply

  pinMode(led1, OUTPUT);
  pinMode(led2, OUTPUT);
  pinMode(led3, OUTPUT);
  pinMode(led4, OUTPUT);
  pinMode(led5, OUTPUT);
  pinMode(led6, OUTPUT);

Now here :

  a = Firebase.getInt("Variable1/Value") ;
  for ( a ; a <= 255 ; a++ );
  {
    analogRead(a);
    analogWrite(led1, a);
    Serial.println("led started");
    delay(10);
  }

what is the plan ? i mean what is this supposed to do ? you get a value, and then you increase the value and write it to the led1 pin, okay, but then    analogRead(a);this does what ? you should read up on analogRead() It should have no effect, you read from a pin which probably doesn’t exist, but the return value is not assigned to anything, so it should get optimized out by the compiler. You should consider what happens when the variable is assigned with a negative value, but that is a different matter.

it has been asked several times what ESP8266 board are you using?
for example, on a WeMos D1 ESP8266 device

#define led4 1
...
    pinMode(led4, OUTPUT);

kills the serial monitor output

now i have refine the code according to suggestion but now there is nothing in serial monitor ? at baud rate’112500’

also its uploaded , and the board used was" NodeMCU0.9( ESP-12 module)"

overall nothing is happening?

#include <ESP8266WiFi.h>

#include <FirebaseArduino.h>


#define FIREBASE_HOST ".................."
#define FIREBASE_AUTH "....................."
#define WIFI_SSID "........."
#define WIFI_PASSWORD "......."



#define led1 12
int a;


#define led2 14
int b;

#define led3 4
int c;

#define led4 1
int d;

#define led5 3
int e;

#define led6 2
int f;


void setup()
{
  Serial.begin(115200);

    pinMode(led1, OUTPUT);
 
    pinMode(led2, OUTPUT);
 
    pinMode(led3, OUTPUT);
 
    pinMode(led4, OUTPUT);
  
    pinMode(led5, OUTPUT);
     
    pinMode(led6, OUTPUT);



  
  WiFi.begin(WIFI_SSID, WIFI_PASSWORD);
  Serial.print("connecting");
  while (WiFi.status() != WL_CONNECTED) {
    Serial.print(".");
    delay(500);
  }
  Serial.println();
  Serial.print("connected:");
  Serial.println(WiFi.localIP());

  Firebase.begin(FIREBASE_HOST, FIREBASE_AUTH);



}
void firebasereconnect()
{
  Serial.println("Trying to reconnect");
  Firebase.begin(FIREBASE_HOST, FIREBASE_AUTH);
}


void loop()
{

  if (Firebase.failed())
  {
    Serial.print("setting number failed:");
    Serial.println(Firebase.error());
    firebasereconnect();
    return;
  }


  a = Firebase.getString("Variable1/Value").toInt () ;

  for ( a=0 ; a <= 255 ; a++ );
  {

    analogWrite(led1, a);
delay(10);
    Serial.println("led started");
    delay(10);
  }




  b = Firebase.getString("Variable2/Value").toInt () ;

  for (b=0 ; b <= 255 ; b++);
  {

    analogWrite(led2, b);
delay(10);
    Serial.println("led started");
    delay(10);
  }




  c = Firebase.getString("Variable3/Value").toInt () ;


  for (c=0 ; c <= 255 ; c++);
  {

    analogWrite(led3, c);
delay(10);
    Serial.println("led started");
    delay(10);
  }



  d = Firebase.getString("Variable4/Value").toInt () ;


  for (d=0 ; d <= 255 ; d++);
  {

    analogWrite(led4, d);
delay(10);
    Serial.println("led started");
    delay(10);
  }


  e = Firebase.getString("Variable5/Value").toInt () ;


  for (e=0 ; e <= 255 ; e++);
  {
    
    analogWrite(led5, e);
delay(10);
    Serial.println("led started");
    delay(10);
  }


  f = Firebase.getString("Variable6/Value").toInt () ;


  for (f=0 ; f <= 255 ; f++);
  {
 
    analogWrite(led6, f);
delay(10);
    Serial.println("led started");
    delay(10);
  }


}

I mentioned in post #9 that the pinMode() statement

#define led4 1
....
pinMode(led4, OUTPUT);

kills my serial output
looking at NodeMCU V0.9 pinout GPIO1 is TXD0
trying moving whatever is on pin GPIO1 to another pin?

Keep in mind that the Pinout of the nodeMCU is dual-referenced. There are references on the silk that show D1, D2, D3 etc. these can be referenced in your sketch exactly like that D1, D2 etc. and there are the GPIO numbers which can be referenced without the 'D' in front as you have been doing. Just in case why don't you show us a schematic of how everything is connected.

if you set the baudrate to 115200

  Serial.begin(115200);

the baudrate of the serial-monitor must be adjusted to 115200 baud too.
The baudrates in your code and in the serial monitor must match = they must be the same value.

#define led4 1
pinMode(led4, OUTPUT);

#define led5 3
pinMode(led5, OUTPUT);

pinMode(led4, OUTPUT); means
pinMode(1, OUTPUT); // make the IO-pin that is used for the serial connection "TX" an output

pinMode(led5, OUTPUT); means
pinMode(3, OUTPUT); // make the IO-pin that is used for the serial connection "RX" an output

so after this definitions your serial connection does not work anymore because you have programmed the IO-Pins 1 and 3 to be used by your program


best regards Stefan