Car project

Hello,

I try to add the joystick, but seems there is an error?

First of all I can’t add a joystick via the Web Dashboard only by the Mobile Dashboard. I did that, but then I can’t see the joystick in the Web Dashboard? I can’t change the datastreams in this case. The new Blynk 2.0 is very strange to navigate.
Can someone please help me with this problem?
Esp8266 + 2 motor drivers
Iphone
• Blynk server
• Blynk Library version, latest

There is no joystick widget for the web dashboard, only mobile.

You need to explain more about your datastream issues if you want assistance in that area.

Pete.

This new blynk 2.0, the Joystick widget has no minimum and maximum value range
I need to set the values from app, but I don’t know how?

They made this app more difficult.


#define BLYNK_PRINT Serial


#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>

//Motor A
const int inputPin1  = 5;    // Pin 15 of L293D IC, D1 Pin of NodeMCU
const int inputPin2  = 16;    // Pin 10 of L293D IC, D0 Pin of NodeMCU
//Motor B
const int inputPin3  = 4;    // Pin  7 of L293D IC, D2 Pin of NodeMCU
const int inputPin4  = 0;    // Pin  2 of L293D IC, D3 Pin of NodeMCU
int EN1 = 12;                 // Pin 1 of L293D IC, D6 Pin of NodeMCU
int EN2 = 14;                 // Pin 9 of L293D IC, D5 Pin of NodeMCU
// Led Light Pin
const int Ledpin = 10;
//---------------

#define BLYNK_DEVICE_NAME "RC "
#define BLYNK_TEMPLATE_ID "TMPLVQkp0ic3"
char auth[] = "--";  //Blynk Authentication Token
char ssid[] = "--";           //WIFI Name
char pass[] = "--";           //WIFI Password

BLYNK_WRITE(V1)
{
  int x = param[0].asInt();
  int y = param[1].asInt();

  // Do something with x and y
  Serial.print("X = ");
  Serial.print(x);
  Serial.print("; Y = ");
  Serial.println(y);

//  int speed =350;
//  analogWrite(EN1, speed);//sets the motors speed
//  analogWrite(EN2, speed);//sets the motors speed
// Joystick Movement
  if (y>350)
  {
    Serial.print("forward");
    forward();
  }

  if (y<170) 
    {
      Serial.print("backward");
      backward();
    }

   if (x<132)
    {
      Serial.print("left");
      left();
    }
 
  if (x>380) 
    {
      Serial.print("right");
      right();
    }

  if ((y==256) && (x==256))
    {
      Serial.print("stop");
      stop();
     }

}

//----------------------
BLYNK_WRITE(V2)
{
  int speed = param.asInt(); // assigning incoming value from pin V2 to a variable
    //speed =350;
    analogWrite(EN1, speed);//sets the motors speed
    analogWrite(EN2, speed);//sets the motors speed

}
//------------------------




void setup()
{
    pinMode(EN1, OUTPUT);   // where the motor is connected to
    pinMode(EN2, OUTPUT);   // where the motor is connected to
    pinMode(inputPin1, OUTPUT);
    pinMode(inputPin2, OUTPUT);
    pinMode(inputPin3, OUTPUT);
    pinMode(inputPin4, OUTPUT);  
    pinMode(Ledpin, OUTPUT);
  
  // Debug console
  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);
}

void loop()
{
  Blynk.run();

}

void left(void)
{
    digitalWrite(inputPin1, HIGH);
    digitalWrite(inputPin2, LOW);
    digitalWrite(inputPin3, HIGH);
    digitalWrite(inputPin4, LOW);  
}

void right(void)
{
    digitalWrite(inputPin1, LOW);
    digitalWrite(inputPin2, HIGH);
    digitalWrite(inputPin3, LOW);
    digitalWrite(inputPin4, HIGH); 
}

void stop(void)
{ 
    digitalWrite(inputPin1, LOW);
    digitalWrite(inputPin2, LOW);
    digitalWrite(inputPin3, LOW);
    digitalWrite(inputPin4, LOW); 
}

void backward(void)
{   
    digitalWrite(inputPin1, LOW);
    digitalWrite(inputPin2, HIGH);
    digitalWrite(inputPin3, HIGH);
    digitalWrite(inputPin4, LOW); 
}

void forward(void)
{ 
    digitalWrite(inputPin1, HIGH);
    digitalWrite(inputPin2, LOW);
    digitalWrite(inputPin3, LOW);
    digitalWrite(inputPin4, HIGH); 
}

This is the code I used.

Best regards,
Tom

Please edit your post and add triple backticks ( ``` ) before and after your sketch.

This topic might help you

The range is set using the min/max values in the datastream for each axis.

Pete.