Current Electron and Blynk Firmwares.. compatible?

Hi all,

Can anyone confirm if there are any incompatibilities / issues with Blynk lib and current electron firmware (0.5.3)

I’ve tried loads of different things including new blynk app project from scratch and numerous tokens etc…

If I download my code to my photon code works fine. If I download same code to electron no data is coming through to my app. Is there anything I need to add in my code in addition to the standard requirements for photon?

Electron is talking OK to console and ubidots etc… so no issue with data plan etc…

Any assistance appreciated!

here is my code:

#include “blynk.h”
#define BLYNK_PRINT Serial
char auth = “xxxxxxxx”;

//Timer handler configuration
#include “SparkCorePolledTimer.h”
SparkCorePolledTimer updateTimer1(30000); //Timer1 (5 minutes) - remote poll
void OnTimer1(void);

//Local configuration
float TnkLvlPV_RAW = A0; //Raw signal data from field
float Tx01 = 0.0; //transmission tag #1 (actual level, scaled)

void setup () {
pinMode(TnkLvlPV_RAW,INPUT);

Blynk.begin(auth); //open connection and authenticate

Serial1.begin(115200); //initiate timer handler
updateTimer1.SetCallback(OnTimer1);

}

BLYNK_WRITE(V2) {
if (param.asInt() == 1) { //If virtual coil “V1” = true, output is on.
digitalWrite(stsLEDg,HIGH);
}
else { // otherwise, output os off.
digitalWrite(stsLEDg,LOW);
}
}
BLYNK_WRITE(V3) {
if (param.asInt() == 1) { //If virtual coil “V3” = true, output is on.
digitalWrite(stsLEDr,HIGH);
}
else { // otherwise, output os off.
digitalWrite(stsLEDr,LOW);
}
}

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

void OnTimer1(void) { //Handler for the timer, will be called automatically
// Read alalogue value assigned to TAG “TankLevelPV_RAW”
Tx01 = analogRead(TnkLvlPV_RAW);
Tx01 = map(Tx01, 0, 4095, 0, 100); //scale raw value to 0-100 %
delay(100);
Blynk.virtualWrite(0, String(Tx01));
Particle.publish(“tint01”, String(Tx01) + " %");
}

Im not great with coding but i am running 0.5.3 on my electron with blynk so i can tell you it does work. Heres some stripped down code that works for me.

#include "blynk/blynk.h"
#include "blynk/BlynkSimpleParticle.h"

STARTUP(cellular_credentials_set("broadband", "", "", NULL));


void setup() {
Serial.begin(9600);
Blynk.begin("insert token here", IPAddress(45,55,130,102), 8442);    //blynk token with electron address
Particle.keepAlive(20);     //number of seconds between keep alive pings. Each ping uses 121 bytes of data
}

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

Thanks. I will include a separate example for that.

I’m not an expert but. I succeeded in connecting by using the token directly in blynk.begin. Note: not my actual token.

Blynk.begin("22e81c4ja71f5kdis2918dc93t9d9211", IPAddress(45,55,130,102), 8442);

Also using the debug feature for blynk helps to see what’s going on.

 #define BLYNK_PRINT Serial // Defines the object that is used for printing
#define BLYNK_DEBUG        // Optional, this enables more detailed prints

Insert as the very first lines in your code.

Just updated particle electron to firmware 0.6.0 and Blynk runs without any issues. I’m chasing “Blynk is offline” notifications but that’s something in my new code I’m sure as the above stripped code works without dropouts.