How i can use the virtual pins for the raspberry pi

how i can use the virtual pins for the rap
spberry pi 3 help

@plof maybe this small script will give you an idea.

var Blynk = require('blynk-library');
var AUTH = '9ae42d15xxxxxxxxxxda5832f1';
var blynk = new Blynk.Blynk(AUTH, options = {
 connector : new Blynk.TcpClient()
});
var v1 = new blynk.VirtualPin(1);  // Button widget
var v9 = new blynk.VirtualPin(9);  // Display widget
v1.on('write', function(param) {
 console.log('V1:', param[0]);
});
v9.on('read', function() {
 v9.write(new Date().getSeconds());  // sends out seconds count to display widget
});
var Gpio = require('/usr/local/lib/node_modules/onoff').Gpio,
  relay = new Gpio(23, 'out');  // Pi BCM # 23

var v2 = new blynk.VirtualPin(2);  // virtual pin to control GPIO 23

v2.on('write', function() {
        if(relay.readSync() == 0) {  // toggle gpio 23 from high to low
                relay.writeSync(1);
        }
        else {
                relay.writeSync(0);
        }
});

In which program is the code? @Costas

@plof any decent text editor, the best is probably Notepad++

@Costas how I install notepad++ in the raspberry

You install notepad++ on a regular computer and then SSH to the Pi etc.

@Costas

It’s not Python, it’s nodejs. Use any text editor, nano or vi if you have to.

Are you actually coding directly on the Pi?

@Costas yes how I save the notepad

Save as javascript .js

So you are using notepad++ now via ssh, right?

I don’t now how can you help me ?

to be honest if you don’t know the basics like ssh you are going to struggle with nodejs.

do you have a “real” computer and if so what is it?

1 Like

I already have the ssh in the pc how I put the java in the console

what editor are you using on the Pi?

Basically, highlight all the text in the nodejs script on your main pc, ssh into the pi, open your pi text editor and then paste.

In the pi the text editor which one other I can use

sudo apt-get install nano

@Costas is like that