Blynk for Beginners and help with your project

Thanks @Costas going to try it out!!

The delay(1000) is only for test purposes to see if bridge works. Once you have it running study SimpleTimer on the Arduino site as this is how BlynkTimer works and must be used in place of the delay() function.

Hello there,

I’m programming a nodemcu without the nodemcu, I mean, I have not right now it but I have too many free time…
I have to send multiples values to blynk, im reading them from softserial port (in this moment I have 20 values) I have to send them to different widgets, it is possible to send them with 20 Blynk.virtualWrite one after the other?
Blynk.virtualWrite (V1, variable1);
Blynk.virtualWrite (V2, variable2);
Blynk.virtualWrite (V3, variable3);

I set the BLYNK_MSG_LIMIT to 100 and I’m running a local server with also a limit of 100 messages per second.

Could those 20 messages overflow the server or the hardware?

Thanks!

So 1 message allowed every 0.01 seconds or every 10ms.
Maybe sandwich a delay(11) between each virtualWrite.

I have found that it’s not wise to go beyond 3 or 4 consecutive virtualWrites.

Well, should be good to know if the overflow is triggered each second, or each 10ms or… should be a watchdog… the sandwitch could be so each 3 virtualWrites?
I think I have to test it, I like test and error procedure! But if not nodemcu, not test and no error :frowning:

Thanks!

This time I’m doing tests with webhooks…

using this code in my project:

#define BLYNK_MAX_READBYTES 1024

BLYNK_WRITE(V0)
{
  Serial.println("WebHook data:");
  Serial.println(param.asStr());
}

BLYNK_WRITE(V10)
{
  if (param.asInt())
  {
  //Blynk.virtualWrite(V0, "https://raw.githubusercontent.com/blynkkk/blynk-library/master/extras/logo.txt");
  Blynk.virtualWrite(V0, "https://api.sunrise-sunset.org/json?lat=41.58491773&lng=1.612949&date=today");
  }
}

I receive this:

[15062] <[14]o:[00]Pvw[00]0[00]https://api.sunrise-sunset.org/json?lat=41.58491773&lng=1.612949&date=today
[15206] >[14]o[1E|00|07]
[15206] >vw[00]10[00]0
[25162] <[06|00|02|00|00]
[25210] >[00|00|02|00|C8]
[32972] >[14]d[A8|00|07]
[32973] >vw[00]10[00]1
[32973] <[14]d[A8|00]Pvw[00]0[00]https://api.sunrise-sunset.org/json?lat=41.58491773&lng=1.612949&date=today
[33179] >[14]uV[00|07]
[33179] >vw[00]10[00]0
[43162] <[06|00|03|00|00]
[43262] >[00|00|03|00|C8]

But no data received even that trying in the explorer all seems working.
If I use the Blynk logo url, it works perfect…

V0 = webhook URL=/pin/ METHOD=GET CONTENT TYPE=application/json BODY=(Cant write nothing here using GET)
V10 = button

Searching in Blynk I found the same issue, it’s set as [SOLVED] but there is no solution inside… @Costas, did you help him by PM? [Solved] Webhook problem

Thanks!

@darkmoon the power of the Webhook widget is the ability to easily modify the API call.

Manually entering the url in the widget is a pain so it’s better to email the url to yourself and paste it into the widget.

Once you have allocated a “pin array” you can easily change the array to get revised data without changing the url.

Just knocked up a project for your call and the original call you referred to.

Data from Serial Monitor is:

41.58
1.61
{"results":{"sunrise":"4:28:04 AM","sunset":"7:12:19 PM","solar_noon":"11:50:11 AM","day_length":"14:44:15","civil_twilight_begin":"3:55:47 AM","civil_twilight_end":"7:44:36 PM","nautical_twilight_begin":"3:15:07 AM","nautical_twilight_end":"8:25:16 PM","astronomical_twilight_begin":"2:28:38 AM","astronomical_twilight_end":"9:11:45 PM"},"status":"OK"}
20151106
1358
20108
{"id":380876,"matchnr":20108,"datetime":"2015-11-06T19:00:00.000Z","matchtypeid":1,"teams":[{"id":1067751,"name":"DOV 4","teamplayers":[{"id":2137382,"name":"M. Petiet","subst":0},{"id":3294276,"name":"S. de Hoogt","subst":0},{"id":3413244,"name":"J. van der Aar","subst":0},{"id":3829013,"name":"D. Bendter","subst":0},{"id":4060662,"name":"R. Holscher","subst":0}],"matchplayers":[{"id":4060662,"name":"R. Holscher","dbl":1},{"id":3413244,"name":"J. van der Aar","dbl":1},{"id":3294276,"name":"S. de Hoogt","dbl":0}]},{"id":1067383,"name":"Stede Broec 5","teamplayers":[{"id":2220119,"name":"J. Broer","subst":0},{"id":3031636,"name":"R. Pronk","subst":0},{"id":3031644,"name":"J. Neuvel","subst":0},{"id":3033183,"name":"P. Sijm","subst":0},{"id":3293759,"name":"T. Buijsman","subst":0}],"matchplayers":[{"id":3293759,"name":"T. Buijsman","dbl":1},{"id":3033183,"name":"P. Sijm","dbl":1},{"id":3031644,"name":"J. Neuvel","dbl":0}]}]}

Sketch is:

// WebhookNEW.ino https://community.blynk.cc/t/blynk-for-beginners-and-help-with-your-project/10000/36
// and https://community.blynk.cc/t/solved-webhook-problem/10279/20 by Costas 21 May 2017

#define BLYNK_MAX_READBYTES 1024
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>


char auth[] = "xxx";
char ssid[] = "xxx";
char pass[] = "xxx";
char server[] = "blynk-cloud.com";

// reference https://ttapp.nl/sbapi?getmatch&date=20151106&clubid=1358&matchnr=20108
int datum =  20151106;
int clubid=  1358;
int matchnr= 20108;

// reference https://api.sunrise-sunset.org/json?lat=41.58491773&lng=1.612949&date=today
float latitude  = 41.58491773;
float longitude = 1.612949;
void setup()
{
  Serial.begin(115200);
  Serial.println("\nStarted");
  Blynk.begin(auth, ssid, pass, server);
}

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

/************************************************************************************************************************/

BLYNK_WRITE(V1){      // Webhook enter https://ttapp.nl/sbapi?getmatch&date=/pin[0]/&clubid=/pin[1]/&matchnr=/pin[2]/
  if (param.asInt() == 1) {
    Blynk.virtualWrite(V2,datum,clubid,matchnr);
    Serial.println(datum);
    Serial.println(clubid);
    Serial.println(matchnr);
  }
}

BLYNK_WRITE(V2){       // Webhook button for https://ttapp.nl/sbapi?getmatch&date=20151106&clubid=1358&matchnr=20108
  String webhookdata = param.asStr();
  Serial.println(webhookdata);
}

/************************************************************************************************************************/

BLYNK_WRITE(V0){   // webhook for sunrise  https://api.sunrise-sunset.org/json?lat=/pin[0]/&lng=/pin[1]&date=today
  String webhookdata = param.asStr();
  Serial.println(webhookdata);
}

BLYNK_WRITE(V3){      // Webhook button for https://api.sunrise-sunset.org/json?lat=41.58491773&lng=1.612949&date=today
  if (param.asInt() == 1) {
    Blynk.virtualWrite(V0,latitude, longitude);
    Serial.println(latitude);
    Serial.println(longitude);
  }
}

Still no luck…

[121504] <[14]55[00|11]vw[00]0[00]41.585[00]1.613
41.58
1.61
[121658] >[14]][AE|00|07]
[121658] >vw[00]10[00]0

could be some configuration on local server side?

There are webhook settings in server.properties, take a look and see if you find anything.

I don’t know whats happening with this url, but I tried with a different one and it works… test again with first one and still don’t work… so… now it’s working

Thanks again @Costas.

@darkmoon count the characters in each json with Notepad++ (or similar) and ensure READBYTES is before the Blynk libraries in your sketch.

hi I am new with blynk. can someone help me with my problem. I had donwload the blynk library for my raspberry and already run it and it works very well. But when I turn off my raspberry and I turn it on I need to run the blynk library with my token so that the device is online to my android. Is there any way that I can do to make it automatically run?

@leomaralmonte answered in your other post.

good afternoon
How to connect a physical button and relay to nodeMcu v-0.9 (esp-12) with the ability to control via blynk?

Let’s say do the synchronization of the button’s status both physical and blink. Thanks

the whole head broke, tried to remake other sketches.
I want to automate the terrarium …
Help me please.!!!

@Maksim1 welcome to the magical world of Blynk.

Are you using the Arduino IDE as I thought there was an example to do just that. Also take a look in Sketch Builder (or Blynk’s GitHub pages) for similar sketches.

Come back to us if you are still struggling.

To all newbies:

We are fast approaching 11,000 members, most are inactive but it’s impossible for us to assist you if you simply say “Blynk is not working, help me, urgent”.

We don’t have the time to format your sketches and ask a dozen questions.

You need help, then help yourself, read at least the first 7 posts in this thread and respond accordingly.

5 Likes

I. Before creating a new topic, please consider the following:

 - this forum is not destined to learn you how to code. To use Blynk you need basic c++ / arduino coding skills.
 - read and UNDERSTAND docs.blynk.cc , and also study examples.blynk.cc , help.blynk.cc
 - update Blynk app, Blynk library, local server and ESP core to latest version. Than check if the issue is still there.
 - be sure to do a thorough search of the site for similar problems / questions
 - DO NOT post unformatted code or serial monitor output
 - DO NOT post screenshots / photos about your code or serial monitor output. No one will bother to read them!
 - DO NOT spam multiple users with private messages asking for help
 - DO NOT ask other users to write code for you. Coding is NOT for free. Sharing knowledge and directions IT IS.
 - choose the topic category accordingly. Do not create uncategorised topics.

Also, keep in mind that choosing the red “issues and errors” category for inapropiate topic, will not result in faster response time, but possibly will be deleted!
The “issues and errors” category is destined for reporting and documenting bugs in the blynk library / app, not in your code / hardware.

II. Start your post with the following details:

 01. The make and model of your phone.
 02. The make / version of the phones OS.
 03. Server type: cloud or local. If local server, the make and model and server version.
 04. The Blynk library version.
 05. The make and model of your board (MCU) and attched peripherals.
 06. How you powering the MCU.
 07. Has the MCU ever succesfully connected to a Blynk server (cloud or local) before?
 08. The IDE you are using, including the version number.
 09. The ESP core version you are using.
 10. The settings you have in the IDE for the MCU.
 11. Sketch size, regarding flash and ram.
 12. PROPERLY FORMATTED code.
 13. Serial debug output / compiling errors - if applicable.
 14. The settings (screenshot) of the widget which is not working properly - if applicable.
 15. Anything else you think is important.

III. Once you have stated the basic details indicated above, describe your problem in detail:

 01. What have you tried?
 02. What did you expect to happen?
 03. What actually happened?

IV. If the question is answered / the issue is solved, please change the topic category to “solved”!

4 Likes

@wanek But… what if they start actualy reading them??

Mal: You know, they walk (learn) just as easily if you lead 'em.
Jayne: (Gunner) I like smacking 'em.

1 Like

yes, this is the other thing i would like to discuss:

to find some way to actually enforce the rules in that list. otherwise we can post this list here or anywhere, if actually no one reads / cares…

  • adding some kind of form - with mandatory fields of the above info - when creating a new topic?
  • it could be a dedicated entry in that form, for pasting code
  • to implement some automatic verification, to look for unformatted code when someone tries to submit a new topic?
    something like: if strings like Blynk.run(), void setup(), void loop(), #include, #define etc are not wrapped with ```, than ignore to post / warn user to format code.

@Dmitriy, it could be doable?

I think we have to start removing posts that don’t adhere to some basic rules and stop formatting code for users. I also hate to see posts that are not assigned to a category and they too should be removed until users take some time to learn how to use the site.

2 Likes