Simona Reti
Simona Reti

Reputation: 29

Blynk & Raspberry PI

I followed this guide to get my Raspi and Blynk connected : http://help.blynk.cc/how-to-connect-different-hardware-with-blynk/raspberry-pi/raspberry-pi-and-blynk . However, when I try to turn on my LED from the app I get the following error:

No direct pin operations available.
Maybe you need to install mraa or onoff modules?

I have installed the modules and it still doesn’t work

Upvotes: 0

Views: 940

Answers (1)

Rajath Gowda
Rajath Gowda

Reputation: 11

Better to use blynk library in python it works fine using python instead of running a node server.

Steps for running Blynk on Raspberry Pi (3B/3B+/4B/Zero) :

  1. Install blynk library for python using pip3
     pip3 install blynklib
     pip3 install gpiozero
  1. Simple code to turn on LED using virtual pin V4
    import gpiozero

    import blynklib
    
    red = LED(17)
    
    BLYNK_AUTH = '<YourAuthToken>' #insert your Auth Token here
    
    blynk = blynklib.Blynk(BLYNK_AUTH)
    @blynk.handle_event('write V4')
    def write_virtual_pin_handler(pin, value):
        print('Current V1 value: {}'.format(value))
        if(value):
            LED.on()
        else:
            LED.off()
    
    while True:
          blynk.run()
    

Upvotes: 1

Related Questions