Continue to get "invalid auth token" in arduino IDE serial monitor

Nodemcu 12-F, ESP8266
communicating over wifi
Blynk library version 1.0.1
i’ve tried countless variables
any ideas?

#define BLYNK_DEVICE_NAME "Motion 2"
#include <ESP8266WiFi.h>    
#include <BlynkSimpleEsp8266.h>
char auth[] = "w3GHXXXXXXXXXXXXXXX7ktY6";

/* WiFi credentials */
char ssid[] = "XXXXXX_2GEXT";
char pass[] = "XXXXXXXX";

/* HC-SR501 Motion Detector */
#define pirPin 5                // Input for HC-S501
int pirValue;                   // Place to store read PIR Value
int pinValue;                   //Variable to read virtual pin

#define BLYNK_PRINT Serial  

 pinValue = param.asInt();    

void setup()
    Blynk.begin(auth, ssid, pass);
    pinMode(pirPin, INPUT);

void loop()
     if (pinValue == HIGH)    

void getPirValue(void)        //Get PIR Data
   pirValue = digitalRead(pirPin);
    if (pirValue) 
       Serial.println("Motion detected");
       Blynk.notify("Motion detected");  

This line isn’t being used…

so it should be removed, or you should change this:

to this:

Blynk.begin(BLYNK_AUTH_TOKEN, ssid, pass);

and then delete this line:

Once you get your device connected then you’ll need to fix your void loop by either polling pirPin with a timer, or attaching an interrupt to it.


1 Like

Beautiful! thanks PeteKnight