Need help with the Value Display widget

Hi everyone! I’m really new to Blynk and I was trying to make a simple project (working on Raspberry Pi 2, using nodejs, Blynk version is the latest as I’ve just installed it) that has a Slider and a Value Display widget. What I want to do is move the Slider and show its value on the Value Display on my app but I can’t make it work. I found an example that does almost the same, it just shows the value on the terminal but not in the app and I don’t know how to change it to make the value appear on the Android app.

The code of the example I found is:


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());

The thing is that I’m not familiar with nodejs, I’ve been looking for some information about functions that Blynk libraries provide but I’ve found much, could someone tell how can I make this work? I would also appreciate a lot if you had information about Blynk functions. Last thing, sorry for my English and sorry if this has been solved in another post, I haven’t had much time to look at all as I’m literally new to all this.

Thank you in advance.

you need to update the value display in your code once you receive the update from the slider.

E.g. slider on V1 and display on V2:

  int sliderValue = param.asInt();                 
  Blynk.virtualWrite(V2, sliderValue);

@wolph42 This OP is using NodeJS, not C++ :wink:

There is some… mostly spread out in the forum. Search for NodeJS.

Meanwhile here is a simple example using a Display Widget, Push Button Widget and the Music Player Widget… in NodeJS… This might help you understand a bit better.

// ----- Music Player Widget -----
var PlayerWidget = new blynk.VirtualPin(17);
var PlayerButton = new blynk.VirtualPin(18);
var PlayerDisplay = new blynk.VirtualPin(19); 

// Activates the Player via button
PlayerButton.on('write', function(param) {  // Watches for button
  if (param == 0) {  // If PlayerButton OFF
    PlayerWidget.write('stop');  // Stop PlayerWidget
    blynk.syncVirtual(17);  // Sync PlayerWidget to process command
    } else if (param == 1) {  // If PlayerButton ON
    PlayerWidget.write('play');  // Play PlayerWidget
    blynk.syncVirtual(17);  // Sync PlayerWidget to process command

// Player functions
PlayerWidget.on('write', function(param) {  // Watches for PlayerWidget
    PlayerDisplay.write(param);  // Shows Player Widget output on Display Widget
      if (param == 'stop') {  // If PlayerWidget 'stop'
        PlayerButton.write(0);  // Toggle PlayerButton OFF 
        // Do something to STOP music/video/etc.
      } else if (param == 'play') {  // If PlayerWidget 'play'
        PlayerButton.write(1);  // Toggle PlayerButton OON
        // Do something to PLAY music/video/etc.
      } else if (param == 'prev') {  // If PlayerWidget 'play'
        // Do something to skip BACKWARD to music/video.etc.
      } else if (param == 'next') {  // If PlayerWidget 'play'
        // Do something to skip FORWARD to music/video/etc.

Thank you so much! I’ve understood it better and I’ve made it work for me!

1 Like

ah missed that one. Good its resolved though!