Hackster is hosting Hackster Holidays, Ep. 6: Livestream & Giveaway Drawing. Watch previous episodes or stream live on Monday!Stream Hackster Holidays, Ep. 6 on Monday!
Volodymyr Shymanskyy
Published © CC BY-NC-SA

Blynk + JavaScript in 20 minutes

Learn how to use Blynk with Node.js on a variety of platforms.

IntermediateProtip30 minutes20,620
Blynk + JavaScript in 20 minutes

Things used in this project

Story

Read more

Code

TCP Client

JavaScript
var Blynk = require('blynk-library');

var AUTH = 'YOUR_AUTH_TOKEN';

var blynk = new Blynk.Blynk(AUTH, options = {
  connector : new Blynk.TcpClient()
});

var v1 = new blynk.VirtualPin(1);
var v9 = new blynk.VirtualPin(9);

v1.on('write', function(param) {
  console.log('V1:', param[0]);
});

v9.on('read', function() {
  v9.write(new Date().getSeconds());
});

SSL Client

JavaScript
var Blynk = require('blynk-library');

var AUTH = 'YOUR_AUTH_TOKEN';

var blynk = new Blynk.Blynk(AUTH);

var v1 = new blynk.VirtualPin(1);
var v9 = new blynk.VirtualPin(9);

v1.on('write', function(param) {
  console.log('V1:', param[0]);
});
v9.on('read', function() {
  v9.write(new Date().getSeconds());
});

WidgetTerminal

JavaScript
Combine it with previous example ;)
var term = new blynk.WidgetTerminal(3);
term.on('write', function(data) {
  term.write('You wrote:' + data + '\n');
  blynk.notify("HAHA! " + data);
});

Github

https://github.com/vshymanskyy/blynk-library-js

Github

https://github.com/vshymanskyy/OpenWRT-Espruino-packages

Credits

Volodymyr Shymanskyy

Volodymyr Shymanskyy

3 projects • 45 followers
Co-founder of Blynk, Dreamer and Doer, Public Speaker

Comments