BlynkSimpleEsp8266 problem

I can’t connect with the internet, this is my topic.

#include <ESP8266wifi.h>
#include <BlynkSimpleEsp8266.h>

#define BLYNK_PRINT Serial

// Define pin connections
const int enablePin = 0;                            // ESP8266 digital pin 0
const int stepPin = 4;                              // ESP8266 digital pin 4
const int dirPin = 5;                               // ESP8266 digital pin 5

// Define Blynk ports
bool TuneRight = false;
bool TuneLeft = false;
bool FineTuneRight = false;
bool FineTuneLeft = false;
bool Scan = false;

// Define networking parameters
char auth[] = "Blynk";        // set the Blynk authentication code
char ssid[] = "My SSID";                               // set the WiFi SSID
char pass[] = "My Password";                             // set the Wifi password


// -- Start of Setup ---------------------------------------------------------------------------------------------------------------------

void setup(){

  Serial.begin(115200);                               // baudrate for serial communication
  Blynk.begin(auth, ssid, pass);                      // network information 
  // Declare pins as Outputs
  pinMode(stepPin, OUTPUT);                           // step pin
  pinMode(dirPin, OUTPUT);                            // direction pin
  pinMode(enablePin, OUTPUT);                         // enable pin
  pinMode(LED_BUILTIN, OUTPUT);                       // onboard LED indicator
}

BLYNK_WRITE(V0){                                      // Blynk virtual pin V0
  TuneLeft = param.asInt();                           // turn left
}
  
BLYNK_WRITE(V1){                                      // Blynk virtual pin V1
  TuneRight = param.asInt();                          // turn right
}

BLYNK_WRITE(V2){                                      // Blynk virtual pin V2
  FineTuneLeft = param.asInt();                       // fine tuning Left
}

BLYNK_WRITE(V3){                                      // Blynk virtual pin V3
  FineTuneRight = param.asInt();                      // fine tunning Right
}

BLYNK_WRITE(V4){                                      // Blynk virtual pin V4
  Scan = param.asInt();                               // scan
}

// -- Main Tunning Function ---------------------------------------------------------------------------------

void Tunning (int Steps, int Rotation){               
  digitalWrite(enablePin, LOW);                       // enable the driver
  for (int i = 0; i < Rotation; i++){                 // loop for motor steps 
    digitalWrite(stepPin, HIGH);                      // perform a step
    digitalWrite(LED_BUILTIN, LOW);                   // turn LED indicator OFF
    delayMicroseconds(Steps);                         // wait for the steps operation
    digitalWrite(stepPin, LOW);                       // stop the step 
    digitalWrite(LED_BUILTIN, HIGH);                  // tuen LED indicator ON
    delayMicroseconds(Steps);                         // wait between steps
    Blynk.run();
  }
}

// -- Start of loop -------------------------------------------------------------------------------

void loop() {                                         
  
  Blynk.run();

  digitalWrite(enablePin, HIGH);                       // disable the driver - will save power and heat on the motor driver
  
  if (TuneRight){                                      // turn right
    digitalWrite(dirPin, LOW);                         // set direction to one side
    Tunning(1500, 320);                                // turn in normal speed
  }

  if (FineTuneRight){                                  // fine turn right
    digitalWrite(dirPin, LOW);                         // set direction to one side
    Tunning(3000, 16);                                 // turn slow, aka "Fine Tune"
  }
  
  if (TuneLeft){                                        // turn left
    digitalWrite(dirPin, HIGH);                         // set direction to the other side
    Tunning(1500, 320);                                 // turn in normal speed
  }

  if (FineTuneLeft){                                    // fine turn left 
    digitalWrite(dirPin, HIGH);                         // set direction to the other side
    Tunning(3000, 16);                                  // turn slow, aka "Fine Tune"
  }

  while (Scan) {                                        // scan as long as the App button is enable
    digitalWrite(dirPin, LOW);                          // set scan direction to one side
    Tunning(1000, 16);                                  // scan quickly, aka "Fast Tune"
  }
}

// -- End of loop ---------------
The code I get on the second monitor is
ets Jan 8 2013,rst cause:4, boot mode:(3,6)

wdt reset

load 0x4010f000, len 3460, room 16

tail 4

chksum 0xcc

load 0x3fff20b8, len 40, room 4

tail 4

chksum 0xc9

csum 0xc9

v00045580

~ld

Best regards, Gerrit

@Gerrit10041951 please edit your post, using the pencil icon at the bottom, and add triple backticks at the beginning and end of your code.
Triple backticks look like this:
```

Pete.

Your void loop is pretty busy, and you have

Blynk.run(); 

in more than one location in the loop. It’s possible this is causing issues I would imagine.

I feel you could likely re-write your main loop to have those blocks in functions called by the virtual pins and keep the loop down to just your

Blynk.run();

but you may need to use Blynks timer function as well.

What happens if you disconnect everything from your board except the USB cable?

Pete.

Still nothing happens, the Blynk app still gives, Wasn’t online yet.
Gerrit

Are you sure the code upload was successful?

What baud rate do you have your serial monitor set to, to enable you to see the device boot messages that you posted earlier?

Pete.

This is what I get by the Verification
Executable segment sizes:
ICACHE : 32768 - flash instruction cache
IROM : 247968 - code in flash (default or ICACHE_FLASH_ATTR)
IRAM : 28261 / 32768 - code in IRAM (IRAM_ATTR, ISRs…)
DATA : 1564 ) - initialized variables (global, static) in RAM/HEAP
RODATA : 2072 ) / 81920 - constants (global, static) in RAM/HEAP

BSS : 25824 ) - zeroed variables (global, static) in RAM/HEAP
De schets gebruikt 279865 bytes (26%) programma-opslagruimte. Maximum is 1044464 bytes.
Globale variabelen gebruiken 29460 bytes (35%) van het dynamisch geheugen. Resteren 52460 bytes voor lokale variabelen. Maximum is 81920 bytes.

I hope you can read the Dutch
The Baudrate I use is 115200
Gerrit

The process of verification doesn’t upload the code to your device.

When you do an upload, does it tell you that the upload has 100% completed, and do you see the “Hard resetting via RTS” message?

Pete.

Yes I do see the Hard resetting via RTS message. It must be the the only control to
see that the upload is correct. Isn’t it?
Executable segment sizes:
ICACHE : 32768 - flash instruction cache
IROM : 247968 - code in flash (default or ICACHE_FLASH_ATTR)
IRAM : 28261 / 32768 - code in IRAM (IRAM_ATTR, ISRs…)
DATA : 1564 ) - initialized variables (global, static) in RAM/HEAP
RODATA : 2072 ) / 81920 - constants (global, static) in RAM/HEAP
BSS : 25824 ) - zeroed variables (global, static) in RAM/HEAP
De schets gebruikt 279865 bytes (26%) programma-opslagruimte. Maximum is 1044464 bytes.
Globale variabelen gebruiken 29460 bytes (35%) van het dynamisch geheugen. Resteren 52460 bytes voor lokale variabelen. Maximum is 81920 bytes.
esptool.py v3.0
Serial port COM4
Connecting…
Chip is ESP8266EX
Features: WiFi
Crystal is 26MHz
MAC: c4:5b:be:62:9c:43
Uploading stub…
Running stub…
Stub running…
Configuring flash size…
Auto-detected Flash size: 4MB
Compressed 284016 bytes to 207165…
Writing at 0x00000000… (7 %)
Writing at 0x00004000… (15 %)
Writing at 0x00008000… (23 %)
Writing at 0x0000c000… (30 %)
Writing at 0x00010000… (38 %)
Writing at 0x00014000… (46 %)
Writing at 0x00018000… (53 %)
Writing at 0x0001c000… (61 %)
Writing at 0x00020000… (69 %)
Writing at 0x00024000… (76 %)
Writing at 0x00028000… (84 %)
Writing at 0x0002c000… (92 %)
Writing at 0x00030000… (100 %)
Wrote 284016 bytes (207165 compressed) at 0x00000000 in 18.3 seconds (effective 124.0 kbit/s)…
Hash of data verified.

Leaving…
Hard resetting via RTS pin…

Gerrit

If you try a simpler sketch, from the sketch builder for example, is the device able to connect to Blynk?

Pete.

I did not try. The sketch I am using is a copy from someone else and there it works.

Gerrit