Completely lost

Near the end of last year, I was able to get an ESP8266 up and running using the old Blynk app and some code that someone else wrote. Worked just fine.

I am new to all of this ESP stuff. I have worked with Arduino and Raspberry Pi, but not ESP.

Then I realize that the original app will not longer be supported and that my working program would soon fail to work. So, I decided to try the Blynk supplied code on this website to connect to my 8266 and move my code and device to the new system. AND…Nothing!!!
I tried getting a new ESP32 to see if that would be better. NOPE! Still nothing!
The 8266 setup via the new app doesn’t work!
I can’t see the device in the WiFi app as directed.
The COM port changes based on either the 8266 (port 3) the 32 (port 6) being uploaded to.

How does anyone even attempt to use this environment? This is really putting me off to the new Blynk as it seems nearly impossible to make work.

Can anyone give me some insight here?
Any suggestions on which boards to get specifically? more specifically from Amazon? SparkFun?

Thanks,
Gary

ESP8266’s and ESP32’s work fine with new Blynk, including the Edgent sketch and it’s dynamic provisioning via the app.

If you have the working Legacy sketch written by someone else then that’s probably the best place to start. It may need as little as three lines of code adding to it to make it work with Blynk IoT.

However, if you want assistance with that from the forum then you need to stay focussed on one sketch, one board and one approach. If you start jumping around from one type of device to another, and swapping to the Edgent approach and back again then you’ll quickly confuse the people who are trying to assist you, along with confusing yourself even more.

Pete.

Thanks Peter for the quick response, but it doesn’t really help me to say “focus”. I have tried the 8266 in the past and now it isn’t working. I was attempting to try the 32 because the 8266 wasn’t working…and I can’t get the 32 to work either.

What I was really looking for was some insight as to the requirements for the software and for the hardware. Is there ANY troubleshooting FAQs? anything that can help if your connection isn’t working? All I have been able to find online is videos that show - plug the device in - copy the code - and upload - VOILA!! It works!

I have not been able to find anything that for “this” type of device, “these” are the settings you need and “these” are the requirements. And if you want to use “this other” device, then you need to have “these” settings and “this” code" and “this” Arduino module loaded.

Gary

Posting your whole sketch might help.
Also, do you have the latest version of the blynk library (1.1.0) installed?

yes I do have 1.1.0 installed

It rather depends on what you’re trying to achieve.
You started by saying…

That code, on that device, is the best place to start - assuming that the code did what you currently want.

Trying to expand an answer to cover all possible scenarios of the two device types you have isn’t something I’m going to do at this stage and you need to be more focussed if you’re going to understand the answers.

Pete.

You’re missing my point. Forget about the other persons code. The issue is ANY code or even a connection. I can’t get the device to show up anywhere to even get access to it and there isn’t any “help” or any sort about requirements or setting or even how the new app widgets are different than the widgets on the old app. How does anyone make this system work? There must be some comprehensive SOMETHING that gets people, say YOU, started and troubleshooting and having a properly set up environment. Otherwise we are just monkeys writing a novel.

Gary

There’s plenty of help and documentation. There’s also the QuickStart process. the Sketch Builder and the board specific examples in the IDE that are installed with the library.

In addition there are lots of guides and FAQs, some of which I’ve written, in this forum.

I’d be willing to help you through that process, but only if you’re prepared to focus on explaining what it is that you’d like to achieve, and what hardware you’d like to achieve it with.

Pete.

Nope, you are missing everyone elses point . . . POST YOUR CODE and we can start to look at why your device is not connecting . . . as Pete said early on in this discssion it may be a simple as adding three lines of additional code to connect to Blynk2.0 . . . but without seing your previously working sketch we are all just guessing.

billd

1 Like

I’m still not sure why no one can admit that the new Joystick layout is completely different. If it was set up and worked the same, I wouldn’t be having these issues, but since everyone seems to think that there will be a miraculous realization with the posting of the code, here it is:

/* JackCarter’s RC Comet Tank /
/
Created by Lucas “Jack Carter” Fierfort /
/
November 2019 */

/* Code made for a NodeMCU and using the Blynk app */

/* Thingiverse page for the plans : Lasercut RC Comet Tank by JackCarter - Thingiverse */

/* You will have to set your own Wi-Fi SSID / password and copy/paste your Blynk authentification token before compiling */

#define MAX_RPM 15

#define BLYNK_PRINT Serial

/The “Stepper.h” library may work instead of the “Stepper2.h”, but the Motor.setDirection() functions will no more be compatible/
//#include <Stepper.h>
#include <Stepper2.h>
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>

#define BLYNK_TEMPLATE_ID “TMPL4ROyKpIQ”
#define BLYNK_DEVICE_NAME “Quickstart Template”
#define BLYNK_AUTH_TOKEN “cULXmIvjhwYTvJBoJtVRUB9oIGuWjFa7”

int Right_Motor_pinOut[4] = {D1,D2,D3,D4};
int Left_Motor_pinOut[4] = {D5,D6,D7,D8};

Stepper2 Motor_Left(Left_Motor_pinOut);
Stepper2 Motor_Right(Right_Motor_pinOut);

int Actual_RightSpeed;
int Actual_LeftSpeed;

int Command_RightTrack;
int Command_LeftTrack;

// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = “Xaz3rdkOIFnEZ7GSAsxMOHtz4I-M_V73”;

//char auth[] = “93CyRP7NMcUXpL7U4FA3W3ZVTgjunC1y”;

// Your WiFi credentials.
// Set password to “” for open networks.
char ssid[] = “XXXXXx”;
char pass[] = “XXXXXXXXXX”;

void setup()
{
Actual_RightSpeed = 0;
Actual_LeftSpeed = 0;

Command_RightTrack = 0;
Command_LeftTrack = 0;
Serial.begin(9600);

Blynk.begin(auth, ssid, pass);
// You can also specify server:
//Blynk.begin(auth, ssid, pass, “blynk-cloud.com”, 80);
//Blynk.begin(auth, ssid, pass, IPAddress(192,168,1,100), 8080);
//pinMode(LED_BUILTIN,OUTPUT);
}

void loop()
{
Blynk.run();

/The actual speed of the motors slowly increase/decrease to the command/
if(abs(Actual_LeftSpeed) < abs(Command_LeftTrack) ) Actual_LeftSpeed++;
if(abs(Actual_LeftSpeed) > abs(Command_LeftTrack) ) Actual_LeftSpeed–;
if(abs(Actual_RightSpeed) < abs(Command_RightTrack) ) Actual_RightSpeed++;
if(abs(Actual_RightSpeed) > abs(Command_RightTrack) ) Actual_RightSpeed–;

Serial.print(Actual_LeftSpeed);
Serial.print("\t\t");
Serial.println(Actual_RightSpeed);

/Setting the right direction according to the sign of the speed command/
if(Command_LeftTrack < 0) Motor_Left.setDirection(0);
if(Command_LeftTrack > 0) Motor_Left.setDirection(1);
if(Command_RightTrack < 0) Motor_Right.setDirection(1);
if(Command_RightTrack > 0) Motor_Right.setDirection(0);

if(Command_LeftTrack != 0 || Command_RightTrack != 0) {
Motor_Left.setSpeed(Actual_LeftSpeed);
Motor_Right.setSpeed(Actual_RightSpeed);

/*The two motors turn a step once one after the others, as two stepper can't turn simultaneously*/
for(int i=0 ; i<15 ; i++) {
  Motor_Left.step(1);
  Motor_Right.step(1);
}

}
}

/Everytime the joystick changes/
BLYNK_WRITE(V0) {

/Get the Blynk joystick values/
int Joystick_x = param[0].asInt();
int Joystick_y = param[1].asInt();
Serial.print(Joystick_x);
Serial.print("\t");
Serial.println(Joystick_y);

/Absolute track speed command. Tracks will actually accelerate until they reach this value/
Command_RightTrack = Joystick_y - Joystick_x ;
Command_LeftTrack = Joystick_y + Joystick_x ;

/The speed commands are capped/
if(Command_RightTrack < -MAX_RPM ) Command_RightTrack = -MAX_RPM ;
if(Command_RightTrack > MAX_RPM ) Command_RightTrack = MAX_RPM ;
if(Command_LeftTrack < -MAX_RPM ) Command_LeftTrack = -MAX_RPM ;
if(Command_LeftTrack > MAX_RPM ) Command_LeftTrack = MAX_RPM ;
}

Gary

Please edit your post, and add triple backticks ``` before and after your whole sketch.

[Unformatted code removed by moderator]

They aren’t triple backticks. Copy and paste the ones that @John93 kindly provided for you if you can’t find the correct character on your keyboard.

Also, John asked you to EDIT your previous post rather than leaving the unformatted code sitting there and reposting it again.

Pete.



/*  Code made for a NodeMCU and using the Blynk app   */

/*  You will have to set your own Wi-Fi SSID / password and copy/paste your Blynk authentification token before compiling   */

#define MAX_RPM 15

#define BLYNK_PRINT Serial

/*The "Stepper.h" library may work instead of the "Stepper2.h", but the Motor.setDirection() functions will no more be compatible*/
//#include <Stepper.h>
#include <Stepper2.h>
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>


#define BLYNK_TEMPLATE_ID "TMPL4ROyKpIQ"
#define BLYNK_DEVICE_NAME "Quickstart Template"
#define BLYNK_AUTH_TOKEN "cULXmIvjhwYTvJBoJtVRUB9oIGuWjFa7"

int Right_Motor_pinOut[4] = {D1,D2,D3,D4};
int Left_Motor_pinOut[4] = {D5,D6,D7,D8};

Stepper2 Motor_Left(Left_Motor_pinOut);
Stepper2 Motor_Right(Right_Motor_pinOut);

int Actual_RightSpeed;
int Actual_LeftSpeed;

int Command_RightTrack;
int Command_LeftTrack;

// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "Xaz3rdkOIFnEZ7GSAsxMOHtz4I-M_V73";

//char auth[] = "93CyRP7NMcUXpL7U4FA3W3ZVTgjunC1y";

// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "XXXXXx";
char pass[] = "XXXXXXXXXX";

void setup()
{
  Actual_RightSpeed = 0;
  Actual_LeftSpeed = 0;

  Command_RightTrack = 0;
  Command_LeftTrack = 0;
  Serial.begin(9600);
  
  Blynk.begin(auth, ssid, pass);
  // You can also specify server:
  //Blynk.begin(auth, ssid, pass, "blynk-cloud.com", 80);
  //Blynk.begin(auth, ssid, pass, IPAddress(192,168,1,100), 8080);
  //pinMode(LED_BUILTIN,OUTPUT);
}

void loop()
{
  Blynk.run();

  
  /*The actual speed of the motors slowly increase/decrease to the command*/
  if(abs(Actual_LeftSpeed) < abs(Command_LeftTrack) )  Actual_LeftSpeed++;
  if(abs(Actual_LeftSpeed) > abs(Command_LeftTrack) )  Actual_LeftSpeed--;
  if(abs(Actual_RightSpeed) < abs(Command_RightTrack) ) Actual_RightSpeed++;
  if(abs(Actual_RightSpeed) > abs(Command_RightTrack) ) Actual_RightSpeed--;

  Serial.print(Actual_LeftSpeed);
  Serial.print("\t\t");
  Serial.println(Actual_RightSpeed);
  
  /*Setting the right direction according to the sign of the speed command*/
  if(Command_LeftTrack < 0) Motor_Left.setDirection(0);
  if(Command_LeftTrack > 0) Motor_Left.setDirection(1);
  if(Command_RightTrack < 0) Motor_Right.setDirection(1);
  if(Command_RightTrack > 0) Motor_Right.setDirection(0);

  if(Command_LeftTrack != 0 || Command_RightTrack != 0) {  
    Motor_Left.setSpeed(Actual_LeftSpeed);
    Motor_Right.setSpeed(Actual_RightSpeed);

    /*The two motors turn a step once one after the others, as two stepper can't turn simultaneously*/
    for(int i=0 ; i<15 ; i++) {
      Motor_Left.step(1);
      Motor_Right.step(1);
    }
  }
}

/*Everytime the joystick changes*/
BLYNK_WRITE(V0) {

  /*Get the Blynk joystick values*/
  int Joystick_x = param[0].asInt();
  int Joystick_y = param[1].asInt();
  Serial.print(Joystick_x);
  Serial.print("\t");
  Serial.println(Joystick_y);
  
  /*Absolute track speed command. Tracks will actually accelerate until they reach this value*/
  Command_RightTrack = Joystick_y - Joystick_x ;
  Command_LeftTrack =  Joystick_y + Joystick_x ;

  /*The speed commands are capped*/
  if(Command_RightTrack < -MAX_RPM ) Command_RightTrack = -MAX_RPM ;
  if(Command_RightTrack >  MAX_RPM ) Command_RightTrack =  MAX_RPM ;
  if(Command_LeftTrack < -MAX_RPM ) Command_LeftTrack = -MAX_RPM ;
  if(Command_LeftTrack >  MAX_RPM ) Command_LeftTrack =  MAX_RPM ;
}


This is what the old Joystick page for Android looked like.

The new one looks nothing like this and give no explanation as to how to set it up and use it.

First of all, you should read this


Just create a string type datastream, then set the mode to advanced, and the code should be the same.

Yup. That’s not the first time I have heard that. The problem is that I don’t know you mean by that. Is there some documentation somewhere that will help me understand what you mean and give me some examples of how to implement what you are suggesting?

There are a number of issues with your sketch that are show-stoppers…

  1. These lines of code…

need to be at the very top of your sketch, as explained in the Device Info screen…

  1. Your Blynk authorisation token is included in these three lines of code, and it’s now called BLYNK_AUTH_TOKEN
    so, you should delete all of this…

and change this line of code…

to this:

Blynk.begin(BLYNK_AUTH_TOKEN, ssid, pass);

Now, when you compile your sketch using Blynk C++ library version 1.x.x the compiler will see the three lines of firmware configuration and know that this is a Blynk IoT sketch, which needs to connect to the Blynk IoT cloud servers, and use the correct url of blynk.cloud rayhjet than the now defunct url of blynk-cloud.com
At the same time, it will be passing the correct Blynk authorisation token to that new IoT server instead of whatever auth token you were previously using.

Your Blynk template needs to have a virtual datasteram assigned to pin V0 and that needs to be a string data type, so that Blynk can pass an array of values to your sketch. This assumes that you use the “Advanced” / “Merged” option for the joystick widget in the app, and choose the V0 datastream for your widget.

Yes, this is Legacy documentation, because believe it or not this was an issue in Legacy too, and the link to the documentation is here (and @John93 already provided a link to it in the post that you replied to, asking for documentation)…

Pete.

Thanks Pete for the direction related to the code updates. I will look into some of these items and make some updates. And yes I did see the link that @John93 sent, but unless I am missing something, I don’t see anything there related to ‘creating a string type datastream’. There does seem to be links in the sidebar related to datastreams, but even those pages seem to be related to REST calls and give no explanation how to incorporate the idea of datastreams in the Arduino code.

The image attached is a screenshot from my phone showing that V0 is not available to choose from the Joystick widget. What am I missing.

Gary

I think we both assumed that your comment of…

Was in reply to @John93’s comment regarding cleaning-up your void loop, bit to do with creating datastreams (which are an entirely Blynk IoT concept).

As far as this is concerned…

You should be logging-in to the web console, locating your Template, going to the Datastreams tab, hitting Edit and ensuring that datastream V0 is a String data type.

I’d recommend that you do as much as you can in the web console, it’s a much more powerful interface.

Pete.