BLYNK
HOME       📲 GETTING STARTED       📗 DOCS       ❓HELP CENTER       👉 SKETCH BUILDER

Photon-code does not work on Blynk local server

Hello everybody,

I have got the following code working with the online Blynk-server:

#define BLYNK_PRINT Serial
#include <blynk.h>
char auth[] = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
int pinValue;

BLYNK_WRITE(V1)
{
  pinValue = param.asInt();
}

void setup()
{
  Serial.begin(9600);
  delay(5000);
  Blynk.begin(auth);
  pinMode(D7, OUTPUT);
}

void loop()
{
  Blynk.run();
  if (pinValue==1)
  {digitalWrite(D7, HIGH);
  }
  else
  {digitalWrite(D7, LOW);
  }
}

When I use the same code for the Blynk local server it doesn’t work:

#define BLYNK_PRINT Serial
#include <blynk.h>

char auth[] = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
int pinValue;

BLYNK_WRITE(V1)
{
  pinValue = param.asInt();
}

void setup()
{

  Serial.begin(9600);
  delay(5000);
  Blynk.begin(auth, IPAddress(192,168,0,101), 8080);
  pinMode(D7, OUTPUT);
}

void loop()
{
  Blynk.run();
  if (pinValue==1)
  {digitalWrite(D7, HIGH);
  }
  else
  {digitalWrite(D7, LOW);
  }
}

I can access my Blynk local server so there is no problem with IP-address. My Blynk local server is also running the latest version and authorisation-code is correct.

Anybody an idea what could be wrong? Thanks in advance,
Bart

What hardware?
What connection method?
What is your serial monitor telling you?
What are your server logs telling you?

Pete.

2 Likes