AccelStepper.h + Blynk Slider


I want to control my thermostat with blynk so i compile the code below. If i increase step number, device disconnects. Im working on nodeMCU, esp8266-01.

I put my stepper codes in BLYNK_WRITE, now i attached time interrupt. Still not working properly. just working for around 250 steps.

#define BLYNK_PRINT Serial
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
BlynkTimer timer;

#include "AccelStepper.h"
AccelStepper stepper(1, 0, 2);  

int previous = 0;
int long newval = 0;
int val;
char auth[] = "...........................";
char ssid[] = "yurdakul";
char pass[] = "Yurdakul2409.";

void setup()
  Blynk.begin(auth, ssid, pass);
  pinMode(3, OUTPUT);
  digitalWrite(3, HIGH);

    timer.setInterval(2000L, stp);

void loop()

  int value = param.asInt();
  val = value;

void stp () {
  if ((val > previous) || (val < previous)) {
    newval = map(val, 0, 80, 0, 220);
    digitalWrite(3, LOW);
    digitalWrite(3, HIGH);
    previous = val;

Because of the nature of stepper motor control, either a specialised controller that takes the load off the MCU (I am guessing they exist), or a Arduino <-- serial/I2c link – > Blynkified MCU option may be required.

1 Like

I will try and add results. Thank you.

I found something. I wanted to move stepper pretty slow so reduced setMaxSpeed. On this configuration, i faced problem that i mentioned before.

Now its runnung on esp8266 and nodeMCU. I set steep to 600 and acceleration to 500. Now i can run around 600 steps without problem.

P.S. I am configuring stepper and thermostat angle with map function, getting values from blynk slider. Maybe map function can be placed in slider widget. I want to show temperature on slider but send angle data.