Advertisement
KRITSADA

BlynkLib01

May 8th, 2019
348
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. from gpiozero import LED
  2. import BlynkLib
  3. import time
  4.  
  5. led1 = LED(25)
  6.  
  7. BLYNK_AUTH = 'YourAuthToken'
  8.  
  9. # Initialize Blynk
  10. blynk = BlynkLib.Blynk(BLYNK_AUTH)
  11.  
  12. # Register Virtual Pins
  13. @blynk.VIRTUAL_WRITE(1)
  14. def my_write_handler(value):
  15.   print('Current V1 value: {}'.format(value))
  16.   if int(value) == 1:
  17.     led1.on()
  18.   else:
  19.     led1.off()
  20.  
  21. # Start Blynk (this call should never return)
  22. blynk.run()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement