#hmm looks like todbot didn t get the

1 messages · Page 1 of 1 (latest)

pastel bobcat
small drift
#

ok, just don't see it in the demo and i don't have one so can only go on what i see... or i could look into the code but your code is so complicated it could be calculating apogee of the moon and i wouldn't know it 😛

#

added ```py
else:
led_pins_per_chip[x][y].value = False
time.sleep(0.001)
led_pins_per_chip[x][y].value = True
await asyncio.sleep(delay)

#

one feature i'd like to put in there which the original 808 doesn't have is when the led goes over a latched led it turns it off then on.

#

because if all the leds are latched... you can't see the scanner

#

that's something that always bothered me about some sequencers

plush plover
#

ah yes

#

I did mention that you need the sleep outside of the if

small drift
#

you and todbot are on a different level than me, it's hard to keep up and understand. i'm trying. you've thrown a lot at me, i've never used non-blocking code in circuit python before.

plush plover
#

how about that ?

async def blink_the_leds(delay_ms=125):
    tick = ticks_ms()
    while True:
        # blink all the LEDs together
        for (x,y) in led_pins:
            led_state = not get_latch(x, y)
            led_pins_per_chip[x][y].value = led_state
            time.sleep(0.001)
            led_pins_per_chip[x][y].value = not led_state
            tick = tick + delay_ms
            await asyncio.sleep((tick - ticks_ms()) / 1000)
small drift
#

i absolutely recognize i've probably bitten off more than i can chew here

plush plover
#

that has the timer thing to try to avoid drift too

#

or that, just flip the LEDs regardless

async def blink_the_leds(delay_ms=125):
    tick = ticks_ms()
    while True:
        # blink all the LEDs together
        for (x,y) in led_pins:
            led = led_pins_per_chip[x][y]
            led.value = not led.value
            time.sleep(0.001)
            led.value = not led.value
            tick = tick + delay_ms
            await asyncio.sleep((tick - ticks_ms()) / 1000)
small drift
#

also for some reason i have to reset the board after every save in mu, it's crashing

plush plover
#

how is it crashing ? I believe there are issues with asyncio maybe ?

small drift
#

i'm trying to get it to crash, it's like a timing issue when i save, almost like when usb timeout happens

#

yeah new code doesn't work well. it's scanning with multiple leds

#

board locks up so i can't see serial, no ctrl+c or ctrl+d

#

forced to hit reset which reconnects and wipes any errors

#

saw some errors last night related to asyncio yeah, maybe because asyncio isn't stable on the pico yet?

#

referenced the asyncio library and run(main)

#

this one still works better ```py
async def blink_the_leds(delay=0.125):
while True:
# blink all the LEDs together
for (x, y) in led_pins:
latched_pin = led_pins_per_chip[x][y]
if not get_latch(x, y):
latched_pin.value = True
time.sleep(0.001)
latched_pin.value = False
await asyncio.sleep(delay)
elif get_latch(x, y):
print(latched_pin, latched_pin.value)
latched_pin.value = False
time.sleep(0.001)
latched_pin.value = True
await asyncio.sleep(delay)

#

it replicates the 808 style great, works great. i'd just like to get that new feature in there.

#

i did work on it last night for a couple hours trying to get the latched ones to flip off/on during the scan with no luck. i did put in some time before asking for help.

plush plover
#

yeah my timing code might be wrong

#

you shouldn't need the elif, just "else:"