Hello,
I have written a python program to operate a few linear actuators via a pico w. I developed an anvil app to operate the python program and it works great. The issue I am having is that the anvil uplink disconnects on any command longer than 28s. I need to leave my relays open longer than that. I am not a programmer, I am not sure I would even qualify as a novice, however, I know solving this is outside of knowledge. The python code is below.
Again, it works but I need someone to write the code so that it does not disconnect after 28s. I am willing to pay for this service. Let me know what it is worth to you.
Please message me or reply if you are interested
Code:
import anvil.pico
import time
import network
import uasyncio as a
from machine import Pin
# This is an example Anvil Uplink script for the Pico W.
# See https://anvil.works/pico for more information
UPLINK_KEY = " (uplink code) "
# We use the LED to indicate server calls and responses.
led = Pin("LED", Pin.OUT, value=1)
pin_OPEN = Pin(21, Pin.OUT, value=0)
pin_CLOSED = Pin(20, Pin.OUT, value=0)
pin_stop = Pin(19, Pin.OUT, value=0)
# Call this function from your Anvil app:
#
# anvil.server.call('pico_fn', 42)
#
@anvil.pico.callable_async
def pico_fn(n):
# Output will go to the Pico W serial port
print(f"Called local function with argument: {n}")
# Blink the LED and then double the argument and return it.
for i in range(10):
led.toggle()
await a.sleep_ms(50)
return n * 2
@anvil.pico.callable_async
def OpenDoor_fn(n):
print(f"Called local function with argument: {n}")
for i in range(30):
pin_OPEN.on()
time.sleep(1)
pin_OPEN.off()
@anvil.pico.callable_async
def Stop_fn(n):
print(f"Called local function with argument: {n}")
for i in range(180):
pin_stop.on()
time.sleep(1)
pin_stop.off()
@anvil.pico.callable_async
def CloseDoor_fn(n):
print(f"Called local function with argument: {n}")
for i in range(30):
pin_CLOSED.on()
time.sleep(1)
pin_CLOSED.off()
# Connect the Anvil Uplink. In MicroPython, this call will block forever.
anvil.pico.connect(UPLINK_KEY)
# There's lots more you can do with Anvil on your Pico W.
#
# See https://anvil.works/pico for more information
About the position:
(Longer description here)
How to apply:
(…)