Invalid auth token on blynk 2.0

i cant connect to blynk cloud somehow,i already double check the aut code

[56276] Connected to WiFi
[56276] IP: 192.168.43.110
[56276] 
    ___  __          __
   / _ )/ /_ _____  / /__
  / _  / / // / _ \/  '_/
 /____/_/\_, /_//_/_/\_\
        /___/ v0.6.1 on ESP8266

[56357] Connecting to blynk-cloud.com:80
[57239] Invalid auth token```

here the code i use
```#define BLYNK_TEMPLATE_ID "TMPLwP4_Ylha"
#define BLYNK_DEVICE_NAME "es"
#define BLYNK_AUTH_TOKEN "t9fudHWdRR2jSIZale0HA-Lbytd6O8en"

#define BLYNK_PRINT Serial

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



char auth[] = "t9fudHWdRR2jSIZale0HA-Lbytd6O8en";

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

// X Stepper Motor
int XstepPin = D1; 
int XdirPin  = D2; 
int limitx = 200; // X stepper motor limit
int speedx = 500; 

// Y Stepper Motor
int YstepPin = D3; 
int YdirPin  = D4; 
int speedy = 500; 
int Movey = 512; // value from blynk joystick "default value"


// Manual control X stepper motor
int vresistor = A0; 
int vrdata = 0; 
SimpleTimer timer;

int pinValue1;
int pinValue2;
int pinValue3;
int pinValue4;


int firstVal, secondVal,thirdVal; // sensors 
// This function sends Arduino's up time every second to Virtual Pin (1).
// In the app, Widget's reading frequency should be set to PUSH. This means
// that you define how often to send data to Blynk App.
void myTimerEvent()
{
  // You can send any value at any time.
  // Please don't send more that 10 values per second.
  Blynk.virtualWrite(V1, millis() / 1000);
  
}



void setup()
{
  // Debug console
  Serial.begin(9600);
  Blynk.begin(auth, ssid, pass);
  pinMode(XstepPin,OUTPUT); 
  pinMode(XdirPin, OUTPUT); 
    pinMode(YstepPin,OUTPUT); 
  pinMode(YdirPin, OUTPUT); 
  pinMode(vresistor, INPUT); 
  timer.setInterval(4000L, StepperMotor); 
    timer.setInterval(300L, StepperMotorY); 


}

void loop()
{

  timer.run(); // Initiates SimpleTimer
  Blynk.run();
}



// From Blynk application to Nodemcu ESP8266

// in Blynk app writes values to the Virtual Pin V2
BLYNK_WRITE(V2) // X stepper Motor limits
{
   pinValue1 = param.asInt(); // assigning incoming value from pin V2 to a variable
   limitx = pinValue1; 
  
}

BLYNK_WRITE(V3) // X stepper Motor Speed
{
   pinValue2 = param.asInt(); 
   speedx = pinValue2; 
  
}

BLYNK_WRITE(V5) // Y Stepper motor control
{
   pinValue3 = param.asInt(); 
   Movey = pinValue3; 
  
}

void StepperMotor()
{
  if( digitalRead(D6) == 1 )
  {
   digitalWrite(XdirPin,HIGH); // Enables the motor to move in a particular direction
 for(int x = 0; x < limitx; x++) {
 digitalWrite(XstepPin,HIGH); 
 delayMicroseconds(speedx); 
 digitalWrite(XstepPin,LOW); 
 delayMicroseconds(speedx); 
 }
 delay(500); // half second delay
 
 digitalWrite(XdirPin,LOW); //Changes the rotations direction
 for(int x = 0; x < limitx; x++) {
 digitalWrite(XstepPin,HIGH);
 delayMicroseconds(speedx);
 digitalWrite(XstepPin,LOW);
 delayMicroseconds(speedx);
 }
 delay(500);
}


}

void StepperMotorY()
{

    if( digitalRead(D6) == 0 )
  {
    vrdata = analogRead(vresistor); 

    if ( vrdata < 100 )
    {
 digitalWrite(XdirPin,LOW);
 digitalWrite(XstepPin,HIGH);
 delayMicroseconds(speedx);
 digitalWrite(XstepPin,LOW);
 delayMicroseconds(speedx);
    }

        if ( vrdata > 900 )
    {
 digitalWrite(XdirPin,HIGH);
 digitalWrite(XstepPin,HIGH);
 delayMicroseconds(speedx);
 digitalWrite(XstepPin,LOW);
 delayMicroseconds(speedx);
    }
  if ( Movey > 512 )
  {
 digitalWrite(YdirPin,HIGH); // Enables the motor to move in a particular direction
 digitalWrite(YstepPin,HIGH); 
 delayMicroseconds(speedy); 
 digitalWrite(YstepPin,LOW); 
 delayMicroseconds(speedy); 

  }

    if ( Movey < 512 )
  {
   digitalWrite(YdirPin,LOW); // Enables the motor to move in a particular direction
 digitalWrite(YstepPin,HIGH); 
 delayMicroseconds(speedy); 
 digitalWrite(YstepPin,LOW); 
 delayMicroseconds(speedy); 
  }
 
  }
}```

Please edit your post, using the pencil icon at the bottom, and add triple backticks at the beginning and end of your code so that it displays correctly.
Triple backticks look like this:

Copy and paste these if you can’t find the correct symbol on your keyboard.

Please do the same for your serial monitor text.

Pete.
1 Like

You should update the library to the latest version (1.1.0).

1 Like

it worked now after update, thanks john

2 Likes