latest android blynk app
local server server-0.41.10
Nodemcu 12E
Iām trying to move a servo to a certain angle with the push of a virtual button. Running uPython, evevrything works smooth until i hit the virtual button then i get a
TypeError: function takes 0 positional arguments but 1 were given
Below is my entire code.
import BlynkLib
import network
import machine
from time import sleep
import time
from machine import Pin
#led = Pin(2, Pin,OUT)
p4 = machine.Pin(5)
servo = machine.PWM(p4,freq=50)
WIFI_SSID = 'Ovie'
WIFI_PASS = 'hebe11one'
BLYNK_AUTH = '59ddffd0b99b4f75a5f87e2b28c159b8'
print("Connecting to WiFi...")
wifi = network.WLAN(network.STA_IF)
wifi.active(True)
wifi.connect(WIFI_SSID, WIFI_PASS)
while not wifi.isconnected():
pass
print('IP:', wifi.ifconfig()[0])
print("Connecting to Blynk...")
blynk = BlynkLib.Blynk(BLYNK_AUTH)
@blynk.on("connected")
def blynk_connected(ping):
print('Blynk ready. Ping:', ping, 'ms')
# Register Virtual Pins
@blynk.VIRTUAL_WRITE(1)
def runLoop():
while True:
blynk.run()
machine.idle()
def myWriteHandler(value):
print('Current V1 value: {}'.format(value))
if int(value) == 1:
servo.duty (120)
else:
servo.duty(69)
# Run blynk in the main thread:
runLoop()