Problem using Blynk-library

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();
}

I’d not know when this kind of code did build in the past, but currently the Blynk library only seems to feature two overloads for BlynkParticle.begin()

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

You may either need to backtrack to a version that did support your kind of overload, or just adopt the new calling scheme.

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

You can try SYSTEM_MODE(ENABLED) and some other SYSTEM_MODE()

But actually questions in regards of the inner workings of Blynk would be best asked at their forum.

Hello Scruffr,

I think the problem is not the local Blynk server but the photon. If I understand it correctly a photon automatically wants to connect to the cloud. As long as it has no connection it will not run the flashed program. And since I want my local Blynk server to work without connection to the cloud the photon can’t connect to the cloud.

I tried adding:

SYSTEM_MODE(MANUAL);
and
SYSTEM_MODE(SEMI_AUTOMATIC);

But this does not seem to work. Is it possible to let the photon run a flashed program without having to be connected to the cloud?

Thanks in advance,
Bart`

If you use SYSTEM_MODE(MANUAL) manual you need to take care of initiating the WiFi connection yourself.

This part is not correct. You have to take some control over the WiFi connection at least partially if you don’t want to use the Particle cloud, but it works fine.

I think that statement was meant as description of the state before employing SYSTEM_THREAD(MANUAL) (so in AUTOMATIC mode) - then it’s correct.
But as already pointed out WiFi.connect() would be the way to manually initiate the WiFi connection.
You also need to make sure to have WiFi.read() before proceding with Blynk.

1 Like

Hello,

Thanks for the response. 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[] = "557c016bfebb439c88c25852cce33ae2";

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();
}
1 Like