Esp8266 as Uno WiFi shell in home robot


Hey there.
Trying to integrate Blynk to my home WiFi robot… I took this project from So I changed code and it’s now looks like that, but not changed what i need most - I need so “cm1”, also executed as V0 pin trigger (when it changing its state to 1 from 0) , and V0 executed as button in Blynk app. How I can change it in code? Thank you.


You could start by posting the formatted code here.

#include <SoftwareSerial.h>
#include <Stepper.h>
#include <ESP8266_HardSer.h>
#include <BlynkSimpleShieldEsp8266_HardSer.h>

//definition of variables

#define BLYNK_PRINT Serial
#define EspSerial Serial

ESP8266 wifi(EspSerial);
char auth[] = "???"; //Ключ к Блинку

const int stepsPerRevolution = 500;
int state = 5;

Stepper rightStepper(stepsPerRevolution, 8,9,10,11);
Stepper leftStepper(stepsPerRevolution, 4,5,6,7);

void setup()
  //start communication

  Blynk.begin(auth, wifi, "???", "???");//Точка доступа и пароль

  //Define motor speed

void loop()

  if (EspSerial.available())  //verify incoming data
    if (EspSerial.find("+IPD,")) //if there is a message
      String msg;
      EspSerial.find("?"); //look for the message
      msg = EspSerial.readStringUntil(' '); //read whole message
      String command = msg.substring(0, 3); //first 3 characters = command
      String valueStr = msg.substring(4);   //next 3 characters = value
      int value = valueStr.toInt();
      if (DEBUG) {
      }move forward
      if(command == "cm1") {
          state = 1;

      //move backward
      if(command == "cm2") {
          state = 2;

      //turn right
      if(command == "cm3") {
          state = 3;

       //turn left
       if(command == "cm4") {
          state = 4;

       //do nothing
       if(command == "cm5") {
          state = 5;


//move forward
  if (state == 1) {
  //move backward
  if (state == 2) {
  //move right
  if (state == 3) {
  //move left
  if (state == 4) {
  //do nothing
  if (state == 5) {


Here is the unformatted code. I need so robot understand cm1 command for triggering button from Blynk, as V0, for example. How I need to change it here.


Sorry. It’s formatting not important for now. Problem in correct command. Pardon for my english. I’m not sure what Blynk library already know, so there some code, that possible even not required.


No it’s not important but it’s vital if you want help.

Does the sketch compile as you have some very old libraries?

Are you using an Uno and an ESP01? If not what are you using?


I have installed 0.34 Blynk libraries, as newer don’t have some shield libraries, that I was need. It’s nothing saying about them when compiling. Except if not mess with “cm1” parameters what i trying. Uno and esp-12f.


You will not get much assistance here if you insist on using old libraries… we don’t like to work in the past :wink:

Please confirm the exact hardware you are using.




I was trying to determine if they are discrete components or the “problematic” UNO WiFi board.

@Cookins Regardless of the hardware and possibly even the age of the libraries, the code you are using is not really well laid out for use with the Blynk libraries, as you have everything lumped into the void loop(). Blynk requires a constant link to the server, so using timed functions for all other IO is necessary.

There have been many different robot type controls in this forum, but I suspect most use DC motors and motor controllers, as Steppers require precise timing that can be difficult to manage simultaneously with with Blynk’s timing requirements.

I suspect you will need to completely redesign your code to work properly with both steppers and Blynk in a differentially driven robot. Search this forum for Steppers for more info.


That isn’t what I asking… I asking for myself, like what command must be there for button worked! As I understand your can’t help me with sketch then maybe you can say what command must be there so it react on buttons. Even if there DC motors, not steppers.


@Cookins would I by right in thinking you haven’t studied any of the basics of Blynk and that you have gone straight to robotic control?


Start by reading the documentation here:

Then you might be able to better understand how to make that mysterious “button command that makes motors work:stuck_out_tongue_winking_eye:

And you might also want to search around this forum for others examples of robots… like mine for instance:


Will do so then. Assist looking at your project. Nice one. Prepare for questions barrage! :smile: