KRITSADA icon

BlynkLib01

KRITSADA | PRO | 05/08/19 06:11:19 PM UTC | 0 ⭐ | 724 👁️ | Never ⏰ | []
Python |

410 B

|

None

|

0 👍

/

0 👎

from gpiozero import LED
import BlynkLib
import time
 
led1 = LED(25)
 
BLYNK_AUTH = 'YourAuthToken'
 
# Initialize Blynk
blynk = BlynkLib.Blynk(BLYNK_AUTH)
 
# Register Virtual Pins
@blynk.VIRTUAL_WRITE(1)
def my_write_handler(value):
  print('Current V1 value: {}'.format(value))
  if int(value) == 1:
    led1.on()
  else:
    led1.off()
 
# Start Blynk (this call should never return)
blynk.run()

Comments