Problem using Blynk-library (with Photon)

Hello everybody,

I had some simple code running to control a simple robot using Blynk. Now I wanted to run it again but I get the following error:

blynkrobotserver.ino:41:65: no matching function for call to ‘BlynkParticle::begin(char [33], char [19], char [10], IPAddress, int)’

This error never occured before. Has there been a change how to use Blynk with a particle photon? Below you can find the code. Thanks in advance,
Bart

#include <blynk.h>
#define BLYNK_PRINT Serial

char auth[] = “xxxxxxxxxxxxxxxxxx”;
char ssid[] = “xxxxxxxxx”;
char pass[] = “xxxxxxxxxxx”;
Servo motor;
Servo actuator;
Servo grijper;

void setup()
{
Serial.begin(9600);
delay(5000); // Allow board to settle
Blynk.begin(auth, ssid, pass, IPAddress(192,168,0,101), 8080);
grijper.attach(D2);
actuator.attach(D1);
motor.attach(D0);
}

BLYNK_WRITE(V1){
motor.writeMicroseconds(param.asInt());}
BLYNK_WRITE(V2){
actuator.writeMicroseconds(param.asInt());}
BLYNK_WRITE(V3){
grijper.writeMicroseconds(param.asInt());}

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

Hello, I fixed your posted code as per the directions you had to delete when posting here :stuck_out_tongue_winking_eye:

As for your issue, you can try this line instead…

Blynk.begin(auth, ssid, pass, "192.168.0.101", 8080);

Hello Gunner,

Thanks for the quick response. Still the same error:

no matching function for call to ‘BlynkParticle::begin(char [33], char [19], char [10], const char [14], int)’

When I look at BlynkParticle.begin() I see:

void begin(IPAddress a, uint16_t p);
// and
void begin(const char* d, uint16_t p);

So it looks like I can only input the IP-address and the port. But how do I add my auth, ssid and pass? The strange thing is that the code worked before and is also mentioned at the github-page for installing and using the local server:

Blynk.begin(auth, IPAddress(xxx,xxx,xxx,xxx), 8080);

Any idea what is wrong? Thanks in advance,
Bart

Looks like something with the Particle IDE perhaps? I don’t use Particle, so I am out of ideas, sorry.

Last ‘blind shot’: define variable char server[]="your.ip.goes.here" and call the begin with server variable defined. If it will not work then I recommend checking the acceptable constructor of begin as defined in library.
Edit: oh, you checked it already… And have you tried with Blynk.config(auth, server, port)

Hello,

I got it running again with the following code:

#include <blynk.h>
#define BLYNK_PRINT Serial
char auth[] = "xxxxxx";
Servo motor;
Servo actuator;
Servo grijper;

void setup()
{    Serial.begin(9600);
    delay(5000); // Allow board to settle
    Blynk.begin(auth, IPAddress(192,168,0,103), 8080);
    grijper.attach(D2);
    actuator.attach(D1);
    motor.attach(D0);
}

BLYNK_WRITE(V1)
{  motor.writeMicroseconds(param.asInt());}
BLYNK_WRITE(V2)
{  actuator.writeMicroseconds(param.asInt());}
BLYNK_WRITE(V3)
{  grijper.writeMicroseconds(param.asInt());}

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

But now the particle photon will only work when my local Blynk server is connected to the internet. The great thing before that if you used the local Blynk server no internet is needed (unless you use cloud-services ofcourse).
Can this be solved so that the local Blynk server can be used without internet-connection?

Thanks in advance,
Bart

?? I don’t know why the internet connection is required. Although I’m not using PArticle photon, I have everything defined the same way (the IP in local net and the 8080 port) and I don’t need the internet connection. Maybe you should check your network settings? Maybe it is the photon’s IP address that should be statically assigned? (Some DNS issue?). Or the App is connected through domain name, not the local IP.

It could be a photon-problem. When disconnect the internetcable form my wifi router I can use the app for about 15 seconds. Than the photon complains that it is not connected to the cloud and the app stops working (the device also disappears in the app).
When I reconnect the internet-cable the photon reconnects with the cloud and the apps works fine again. Seems like a photon-problem.

Other question, so the blynk local server can work without internet. In the future I’ll be using an arduino MKR1000. I assume the problem won’t occur then?

Hello,

I solved the problem. I added WiFi.on() and WiFi.connect() as shown in the code below. Now it works. Thanks for all the help.

SYSTEM_MODE(SEMI_AUTOMATIC);
#include <blynk.h>
#define BLYNK_PRINT Serial
char auth[] = "xxxxxxxxxxxxxxxxxxx";

Servo motor;
Servo actuator;
Servo grijper;

void setup()
{
    Serial.begin(9600);
    delay(5000); // Allow board to settle
    WiFi.on();
    WiFi.connect();
    Blynk.begin(auth, IPAddress(192,168,0,103), 8080);
    grijper.attach(D2);
    actuator.attach(D1);
    motor.attach(D0);
}

BLYNK_WRITE(V1)
{
  motor.writeMicroseconds(param.asInt()); //1000 is links; 2000 is rechts, 1500 is neutraal
}

BLYNK_WRITE(V2)
{
  actuator.writeMicroseconds(param.asInt()); //1500 is naar beneden, 1000 is helemaal omhoog
}

BLYNK_WRITE(V3)
{
  grijper.writeMicroseconds(param.asInt()); //1000 is helemaal open, 2000 is helemaal dicht
}

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

Hello,

Just to be clear. With the code I posted you can connect to the local Blynk server without internetconnection.

Greetings,
Bart