BLYNK
HOME       📲 GETTING STARTED       📗 DOCS       ❓HELP CENTER       👉 SKETCH BUILDER

Blynk library is not recognized in Micropython

esp8266
#1

I am using Micropython to control ESP8266 V2 with wifi communication to the internet.
My Blynk is at my iPad with iOS, version 12.2. In order to integrate Blynk to my projects, I uploaded the Micropython library making a sudo -H pip3 install Blynk-library-python. Then I created main.py with the example given in https://github.com/vshymanskyy/blynk-library-python/blob/master/examples/hardware/ESP8266_ESP32.py, replacing my SSID, password and token with my own.
My problem is the library is not recognized my the board. The error message I get is:

Traceback (most recent call last):
File “main.py”, line 16, in
ImportError: no module named ‘BlynkLib’

Is there something wrong in my procedure? Did I miss something? Please advise.
Thanks

import BlynkLib
import network
import machine

WIFI_SSID = 'YourWiFiNetwork'       
WIFI_PASS = 'YourWiFiPassword'

BLYNK_AUTH = 'YourAuthToken'

print("Connecting to WiFi...")
wifi = network.WLAN(network.STA_IF)
wifi.active(True)
wifi.connect(WIFI_SSID, WIFI_PASS)
while not wifi.isconnected():
    pass

print('IP:', wifi.ifconfig()[0])

print("Connecting to Blynk...")
blynk = BlynkLib.Blynk(BLYNK_AUTH)

@blynk.ON("connected")
def blynk_connected(ping):
    print('Blynk ready. Ping:', ping, 'ms')

def runLoop():
    while True:
        blynk.run()
        machine.idle()

# Run blynk in the main thread:
runLoop()
0 Likes

#2

I have never installed Python on an ESP, just on RPI. But what you used and what is shown in the documentation (for ESP install) seems different…

0 Likes

#3

the library and the code I used comes from the same Git repository. I am following the step by step recipe in order to avoid further problems, so it should work but it does not… On a previous stage, also installed and tried to “import” the library you refer to, but with no success either

I am certain the libraries have been installed, but the board does not seem to acknowledge it.

0 Likes

#4

That sounds like you used the install for RPi / Linux

image

What you need is this… as previously linked above…

0 Likes

#5

I uploaded the library to the device directly, and worked just fine. Thanks a lot

1 Like