Hello,
I am using blink-lib python library from official git here and I am following someone’s tutorial’s here but due to there’s no option for raspberry pi zero so I choose generic board with ethernet connection. even though I am using same smartphone for tethering pi zero and controlling blink app, my blink-app says “wasn’t connected yet”.
I am sure my token is correct, pi zero has internet connection by tether, and blink library is installed (showed up blink ascii logo when running)
here’s my script:
import RPi.GPIO as GPIO
import blynklib
import time
GPIO.setmode(GPIO.BCM)
GPIO.setwarnings(False)
GPIO.setup(11, GPIO.OUT)
p=GPIO.PWM(11, 50)
p.start(7.5)
auth_token= 'my token was here...'
#Initialize blynk
blynk = blynklib.Blynk(auth_token)
@blynk.handle_event('write V0')
def write_handler_pin_handler(pin, value):
Doorlock = (format(value[0]))
if Doorlock =="0":
p.ChangeDutyCycle(12.5)
print("Door Locked")
elif Doorlock =="1":
p.ChangeDutyCycle(7.5)
print("Door Unlocked")
try:
while True:
blynk.run()
except KeyboardInterrupt:
print("Quit")
# Reset GPIO settings
GPIO.cleanup()