Read a RaspberryPi's GPIO to turn on a LED on the Blynk app


I’m new here and until now I’ve tested the typical Javascripts codes (Blynk + JavaScript in 20 minutes [Raspberry Pi, Edison, Espruino …] by vshymanskyy). I understand how I can turn a LED on from a button of the Blynk app. That’s easy BUT… What I want to do is to light a virtual LED in the app by pushing a physical button connected to a Raspberry Pi’s GPIO. As simple as that!

Thanks for your help!

The same in Spanish:


Soy nuevo aquí y hasta ahora he probado los códigos javascripts típicos (Blynk + JavaScript en 20 minutos [Raspberry Pi, Edison, Espruino …] por vshymanskyy). Entiendo cómo puedo encender un LED desde un botón de la aplicación Blynk. Eso es fácil, pero … Lo que quiero hacer es encender un LED virtual en la aplicación pulsando un botón físico conectado a una GPIO de la Raspberry Pi 3. ¡Tan sencillo como eso!

¡Gracias por tu ayuda!

1 Like

AFAIK, LED Widget cannot read from digital pins? @Pavel, @Dmitriy ?

1 Like

Should it? You may use Blynk.virtualWrite(pin, value);

1 Like

@Kevin_Pulido please go through examples. There is one exactly for that case

1 Like

Hi @Dmitriy!

I see that the example was made to use for an Aduino platform, but actually, I only have a RaspberryPi 3 and for that reason I’d need the equivalent code for my board thereby I’d be able to run _‘node LED_StatusOfButton.js’

PD: I’ve noticed a lot of code examples for the Arduino platform, and I was wondering if there are blogs/git/whatever where the users might share scripts.js. I would like to use those tons of instructions currently used on arduino’s codes to re-use (or translate) them in Javascript’s codes instead.


We really need a way of converting the countless Arduino scripts into JavaScript. :pizza:

Did you manage to do it ? Im trying to get the same thing. here’s some info :slight_smile:

Nice ! I will look in to this.
I let you know if it works.
Bedankt :wink:

np :wink: You probably have to install that library using npm (sudo npm install pi-gpio) or something similar

1 Like

This issue was solved?

I’m trying to get the same thing