Advertisement
KRITSADA

Simple Blynk Start

May 28th, 2019
383
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.57 KB | None | 0 0
  1. import BlynkLib
  2. import network
  3. import machine
  4.  
  5. WIFI_SSID = 'INEX108'
  6. WIFI_PASS = 'xxxxxxxx'  
  7. BLYNK_AUTH = '3cfccdecb4e04cbbaa3cac8988ef9a52'
  8.  
  9. print("Connecting to WiFi...")
  10. wifi = network.WLAN(network.STA_IF)
  11. wifi.active(True)
  12. wifi.connect(WIFI_SSID, WIFI_PASS)
  13. while not wifi.isconnected():
  14.     pass
  15. print('IP:', wifi.ifconfig()[0])
  16. print("Connecting to Blynk...")
  17. blynk = BlynkLib.Blynk(BLYNK_AUTH)
  18. @blynk.ON("connected")
  19. def blynk_connected(ping):
  20.     print('Blynk ready. Ping:', ping, 'ms')
  21.  
  22. while True:
  23.     blynk.run()
  24.     print('a')
  25.     machine.idle()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement