Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No easy way to push data to Blynk APP #3

Open
ghost opened this issue Feb 2, 2018 · 0 comments
Open

No easy way to push data to Blynk APP #3

ghost opened this issue Feb 2, 2018 · 0 comments

Comments

@ghost
Copy link

ghost commented Feb 2, 2018

Even the library contains the virtualWrite(conn, ...) API, it is not possible to push easly data to Blynk server in a Timer callback.

You suggested me this workaround:

load('api_gpio.js');
load('api_blynk.js');
load('api_timer.js');

let bConn;  // Blynk connection, to be initialized by the setHandler

Blynk.setHandler(function(conn, cmd, pin, val, id) {
  bConn = conn;
}, null);

Timer.set(1000, 1, function() {
  if (!bConn) return;  // not yet initialized
  Blynk.send(....);
}, null);

However I have a question:
Are you sure the blynk handler callback is invoked even if no "vr" or "vw" commands are triggered from the Blynk app?

If not, the APP should send a "fake" "vr" commnad in order to get the bConn variable initialized. This is not a big deal.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

0 participants