#hmm looks like todbot didn t get the
1 messages · Page 1 of 1 (latest)
No, the LEDs in picostepseq do latch, but since the LEDs also display play position and have a fade effect, there's a bit of logic going on. You can see it starting on code.py line 188. Basically it takes the state of each step of the sequence, sees if its on or not, then combines that with play position and fade effect to create the final brightness of the LED
https://github.com/todbot/picostepseq/blob/main/circuitpython/picostepseq/code.py#L188
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 😛
@plush plover i found a slight issue with the code where all latched buttons were being skipped over by the led. figured out how to fix it i think, it at least works aesthetically. https://github.com/DJDevon3/My_Circuit_Python_Projects/tree/main/Boards/raspberrypi/Raspberry Pi Pico/TR Cowbell/v1.2
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
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.
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)
i absolutely recognize i've probably bitten off more than i can chew here
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)
also for some reason i have to reset the board after every save in mu, it's crashing
how is it crashing ? I believe there are issues with asyncio maybe ?
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.