Blynk arduino connection comes out ! after few times

i connect arduino to pc using arduino usb serial tool (blynk-ser) the connection work properly and after few second it comes out ,my project is to control stepper speed using slider

// You could use a spare Hardware Serial on boards that have it (like Mega)
#include <SoftwareSerial.h>
SoftwareSerial DebugSerial(2, 3); // RX, TX

#define BLYNK_PRINT DebugSerial
#include <BlynkSimpleStream.h>

char auth[] = "";


void setup() {
  // put your setup code here, to run once
   Serial.begin(9600);
  Blynk.begin(Serial, auth);
  pinMode(10,OUTPUT);
   pinMode(11,OUTPUT);
    pinMode(12,OUTPUT);
     pinMode(13,OUTPUT);
  

}

void stepperspeed(int del){
   
   
  while(del!=10){ 
  digitalWrite(10,HIGH);
  digitalWrite(12,LOW);
  digitalWrite(11,LOW);
  digitalWrite(13,LOW);
  delay(del);
  digitalWrite(10,LOW);
  digitalWrite(12,HIGH);
  digitalWrite(11,LOW);
  digitalWrite(13,LOW);
  delay(del);
  digitalWrite(10,LOW);
  digitalWrite(12,LOW);
  digitalWrite(11,HIGH);
  digitalWrite(13,LOW);
  delay(del);
  digitalWrite(10,LOW);
  digitalWrite(12,LOW);
  digitalWrite(11,LOW);
  digitalWrite(13,HIGH);
  delay(del);
  }
   
}
void loop() {
  // put your main code here, to run repeatedly:
  Blynk.run();
}
BLYNK_WRITE(V2)
{
    int del = param.asInt()*10;
    stepperspeed(del);
 
}`Preformatted text`

Not sure of your meaning of this… disconnect? timeout? flood error? something else…

Odds are you are trying to do too much, too fast, for the AppServerDevice (Arduino) connection.

http://help.blynk.cc/blynk-basics

Controlling a stepper directly (digitalWrite() pin pulses) across Blynk communication will be a big (and unlikely) challenge, you will probably need a controller board and library support for more dedicated hardware control.

1 Like

Use the built in stepper library. That works much more effeciently. I’m not sure how your stepper is connected, I presume via a Motor driver board or chip (which is really needed, otherwise you might blow up your Arduino).

1 Like