我按照本指南来连接我的Raspi和Blynk:http://help.blynk.cc/how-to-connect-different-hardware-with-blynk/raspberry-pi/raspberry-pi-and-blynk。但是,当我尝试从应用程序打开我的LED时,我收到以下错误:
No direct pin operations available.
Maybe you need to install mraa or onoff modules?
我已经安装了模块但它仍然无法正常工作
答案 0 :(得分:1)
更好地在python中使用blynk库,使用python而不是运行节点服务器可以很好地工作。
在Raspberry Pi(3B / 3B + / 4B / Zero)上运行Blynk的步骤:
pip3 install blynklib
pip3 install gpiozero
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()