BLYNK
BLYNK.IO       📲 GETTING STARTED       📗 DOCS       👉 SKETCH BUILDER

Help install static ip ethernet sheild arduino mega Blynk V2.0

Hello everyone
I am having problem with static IP setting for ethernet sheild
The error screen is Invalid auth token.

Below is my code.
Hope everybody help please

#define BLYNK_TEMPLATE_ID "xxxxxx"
#define BLYNK_DEVICE_NAME "xxx"
#define BLYNK_AUTH_TOKEN "xxxxxxxx"

// Comment this out to disable prints and save space
#define BLYNK_PRINT Serial
char auth[] = BLYNK_AUTH_TOKEN;

#include <SPI.h>
#include <Ethernet.h>
#include <BlynkSimpleEthernet.h>


byte arduino_mac[] = { 0xDE, 0xED, 0xBA, 0xFE, 0xFE, 0xED };
IPAddress arduino_ip ( 192,   168,   0,  44);
IPAddress dns_ip     (  8,   8,   8,   8);
IPAddress gateway_ip ( 192,   168,   0,   231);
IPAddress subnet_mask(255, 255, 255,   0);

BlynkTimer timer;

// This function is called every time the Virtual Pin 0 state changes
 BLYNK_WRITE(V0)
{
  // Set incoming value from pin V0 to a variable
  int value = param.asInt();

  // Update state
  Blynk.virtualWrite(V1, value);
}

// This function sends Arduino's uptime every second to Virtual Pin 2.
void myTimerEvent()
{
  Blynk.virtualWrite(V2, millis() / 1000);
}

void setup()
{
  Serial.begin(115200);
  Blynk.begin(auth, "blynk.cloud.com", 80, arduino_ip, dns_ip, gateway_ip, subnet_mask,    arduino_mac);
  timer.setInterval(1000L, myTimerEvent);
}

void loop()
{
  Blynk.run();
  timer.run();
}

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

1 Like

The new blynk server is “blynk.cloud” not “blynk.cloud.com

1 Like

Thank you, that’s the perfect solution for me!