Erratic behavior with serial USB connection to Pro Micro

I have some problems with updates over serial USB… First of all, the batch file seems to reconnect quite often (due to EOF). Secondly, the widgets are not updating - when I start the dashboard, they are updated once, then they keep the values until I restart the dashboard again. The “device is not on the network” sometimes appears, sometimes it does not.

Try to :

  • Restart board;
  • Change USB port;
  • Post your code here. Most probably problem in it;

Maybe you have many widgets and his is too much for your board?

The code (minus the bike code) is about here:

#include <Wire.h>
//#define BLYNK_PRINT Serial
#include <BlynkSimpleSerial.h>

char auth = “1414842b2fdf410fa6581ab4a77ba0ed”;

void setup() {
Serial.begin(9600);
Blynk.begin(auth);
Wire.begin();

digitalWrite(7, HIGH);
digitalWrite(8, HIGH);

}

void loop(){

kph = (100 * 36) / (delta * 2);

Blynk.virtualWrite(V0,kph);

Blynk.virtualWrite(V1,distance);

Blynk.run();
}

delta and distance are changed in an interrupt, but I doubt there should be any problems there. Besides I had similar problems with an example code.

The bat gives the following output repeatedly:

Connect(“cloud.blynk.cc”, “8442”) - OK
InOut() START
DSR is OFF
Received EOF
EVENT_CLOSE
InOut() - STOP
Disconnect() - OK
Connect(“cloud.blynk.cc”, “8442”) - OK
InOut() START
DSR is OFF
Received EOF
EVENT_CLOSE
InOut() - STOP
Disconnect() - OK
Connect(“cloud.blynk.cc”, “8442”) - OK
InOut() START
DSR is OFF

There was include of BlynkSimpleSerial.h in the header, of course.

You can’t do

Blynk.virtualWrite in loop. This will create high load on your board and it will be restarted. We have a bunch of examples showing how to use many features of Blynk. Please look at them. Specific for your case (but for ethernet) is here.

Oh, yes… I have been cleaning up the code and moved the instructions incorrectly… :frowning: