Blynk data delay between updates

Hi guys
I’m building a level monitor for a tank using electron and wish for the updates to be in 5 minute intervals. I am pushing the data to Ubidots (working fine) and blynk (not working). My understanding coding is not that flash so please excuse me but I’m really hoping someone can help!
If the delay is between 1 and 10 seconds, updates come through to blynk OK. but I want the data to only be pushed after 5 minute intervals, as this is electron and I wish to conserve data. So I am finding that data is arriving perfectly on Ubidots server but just not updating on blynk. Is the server timing out? I’ve extended the heartbeat timeout in blynkConfig.h from 10 to 333 but not helping.

blynk is great and really means a lot to me as part of my project - where am I going wrong?
Thanks in advance guys.
here is my code:

int TnkLvlPV_RAW = A0; //raw signal data from field
float Tx01 = 0.0; //transmission tag
char resultstr[64];

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

Blynk.begin(auth);
Serial.begin(115200);
}

void loop() {
// Read alalogue value assigned to TAG “TankLevelPV_RAW”
Tx01 = analogRead(TnkLvlPV_RAW);
Tx01 = map(Tx01, 0, 4095, 0, 100); //scale the value to 0-100X
sprintf(resultstr, “{"value":%.4f}”,Tx01);

delay(100);
Spark.publish("Tx01", String(Tx01) + " %");
Particle.publish("PostToUbidots", Tx01);
Blynk.run();
Blynk.virtualWrite(3, String(Tx01));
ubidots.add("Tx01", Tx01);
ubidots.sendAll();
delay(300000);//send again in 5 minutes

}

you need to use simpleTimer code, more info here: simpleTimer

@Dave1829 thanks for your reply… there does not seem to be a ported lib under the particle system for "simpletimer…
can you possibly please provide me with a code example even? Im not that good with my programming sorry. any help you can offer is appreciated

then you need to get good at using the SEARCH feature! :smiley:

http://community.blynk.cc/search?q=particle%20simpletimer

@Dave1829 Im sorry, perhaps my understanding of a support community forum was clearly incorrect Credit to those that have the ability, time and experience to understand and excel in code writing. unfortionately not all of us are in this position; myself I am simply reaching out for some support and assistance with respect to writing the correct method (this is why I shared my code). I have had many late nights trying to have a go and have come to this crossroad. and yes, thats included HOURS and HOURS of searching.

Is there someone else within the Blynk community whom can perhaps provide me with some guidance using my code as example?

Learn how to post your sketch so we can read it.

loop() can’t have ANY delays, remove the 5 minutes entry.

Arduino’s use Simple Timer http://playground.arduino.cc/Code/SimpleTimer

You should use the equivelant for your hardware, SparkCorePolled not SparkIntervalTimer as per Conflict in blynk and spark interval timer library

Study SimpleTimer even though it is not for your hardware. Search for the many references on this site to why it is needed and then implement with SparkCorePolled library.

1 Like

@IoTics1,
in the default Blynk library example for Particle, there’s a note:

 * WARNING: It is recommended to use SparkCorePolledTimer library
 *          to make periodic actions (similar to SimpleTimer on Arduino).
1 Like

@Costas @vshymanskyy Thank you guys. I’ll check it out and have a crack.
Cheers

@IoTics1 also for you scenario it may be easier to consider Blynk HTTP API. (In case you device will go to sleep)

1 Like

i guess, so?

i thought this a “community of Blynk users forum” not a “support for Blynk users” forum…

but i make no apologies for trying to help you help yourself, directing you the search feature whilst you waited for the Blynk legends to arrive…

yes, full credit to those people! i am not one of them…

i personally learned the most about Blynk from the wealth of existing information and experience contained in the search archives, i also think most new users can benefit from it too…

1 Like

Please note:
The Blynk developers named this site

This category is titled

In a community, people support each other; ask for what they need and give what they can and are willing. Does “Need Help With My Project” need any further explanation?

Let’s get back on topic and focus on helping this user increase their understanding and get their project working.

1 Like

do you know much about Particle?

can you add anything here: Current Electron and Blynk Firmwares.. compatible?