File tree Expand file tree Collapse file tree 1 file changed +38
-1
lines changed Expand file tree Collapse file tree 1 file changed +38
-1
lines changed Original file line number Diff line number Diff line change 11# blynk-library-py
22
3- ## Work in progress...
3+ ## Usage
4+
5+ ``` py
6+ import BlynkLib
7+ import time
8+
9+ BLYNK_AUTH = ' YourAuthToken'
10+
11+ # Initialize Blynk
12+ blynk = BlynkLib.Blynk(BLYNK_AUTH )
13+
14+ # Register Virtual Pins
15+ @blynk.VIRTUAL_WRITE (1 )
16+ def my_write_handler (value ):
17+ print (' Current V1 value: {} ' .format(value))
18+
19+ @blynk.VIRTUAL_READ (2 )
20+ def my_read_handler ():
21+ # this widget will show some time in seconds..
22+ blynk.virtual_write(2 , time.ticks_ms() // 1000 )
23+
24+ # Start Blynk (this call should never return)
25+ blynk.run()
26+ ```
27+
28+ ## Notes
29+
30+ For some diveces (like PyCom WiPy) you need to setup internet connection first:
31+ ``` py
32+ from network import WLAN
33+
34+ WIFI_SSID = ' YourWiFiNetwork'
35+ WIFI_AUTH = (WLAN .WPA2 , ' YourWiFiPassword' )
36+
37+ wlan = WLAN(mode = WLAN .STA )
38+ wlan.connect(WIFI_SSID , auth = WIFI_AUTH , timeout = 5000 )
39+ print (wlan.ifconfig())
40+ ```
You can’t perform that action at this time.
0 commit comments