BLYNK
HOME       📲 GETTING STARTED       📗 DOCS       ❓HELP CENTER       👉 SKETCH BUILDER

[RobotDyn WIFI D1 R2]Login timeout

Hi. I have RobotDyn WIFI D1 R2. I have Error with connect to server. First Connection work, but only first. Next are Login Timeout Error. This is my Code

#define BLYNK_PRINT Serial    // Comment this out to disable prints and save space
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
#include <SimpleTimer.h>

// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "MYTOKEN"; //insert here your token generated by Blynk

float temp;
int tempPin = 17; // ADC pin

SimpleTimer timer;

void setup()
{
  Serial.begin(9600); // See the connection status in Serial Monitor
  Blynk.begin(auth, "MY SSID", "MYPASS"); //insert here your SSID and password

  // Setup a function to be called every second
  timer.setInterval(5000L, sendUptime);
}

// This function sends Arduino's up time every second to Virtual Pin (5).
// In the app, Widget's reading frequency should be set to PUSH. This means
// that you define how often to send data to Blynk App.
void sendUptime()
{
  // You can send any value at any time.
  // Please don't send more that 10 values per second.
 
  Blynk.virtualWrite(10, temp); // virtual pin 10
}

void loop()
{
  Blynk.run(); // Initiates Blynk
  timer.run(); // Initiates SimpleTimer
 // delay(1000);
   temp = analogRead(tempPin);
   temp = temp * 0.09765625; // costance (1/1024*100)
  
}

Try leaving the loop as “free” as possible, take below part and leave it into your “senduptime” function.

Thanks for reply. Unfortunately don’t work. Any other ideas?

Ok I spent one more hour and partitialy works. On Phone i saw messages “Device was dissconected” And LOG.

[123313] Connecting to 46.101.143.225:8442
[132424] Connecting to 46.101.143.225:8442
[138655] Connecting to 46.101.143.225:8442
[145176] Connecting to 46.101.143.225:8442
[150054] Ready (ping: 11ms).
[158410] Connecting to 46.101.143.225:8442
[165071] Connecting to 46.101.143.225:8442
[171471] Login timeout
[174471] Connecting to 46.101.143.225:8442
[181622] Connecting to 46.101.143.225:8442
[188215] Connecting to 46.101.143.225:8442
[194377] Connecting to 46.101.143.225:8442
[199398] Ready (ping: 8ms).

@Marcin_Zasuwa in your sketch you have a comment that the ADC pin is 17.

Are you sure it is 17 and not A0?

Awesome. I copy and paste code. After I changed to “A0” it worked, but it disconnect less. Why? I use 160MHz and Code like up :smiley: