Weird results in interactive mode
Sometimes I'm getting weird results when using the interactive REPL. No idea why. I'm investigating. I've just put this issue here incase anyone else comes across it.
Looks like it's due to MicroPython not keeping up when in interactive mode. Not quite sure why but the following works:
def show_unroll(self):
self.sm.put(self.pixels[0],8)
self.sm.put(self.pixels[1],8)
self.sm.put(self.pixels[2],8)
self.sm.put(self.pixels[3],8)
self.sm.put(self.pixels[4],8)
self.sm.put(self.pixels[5],8)
self.sm.put(self.pixels[6],8)
self.sm.put(self.pixels[7],8)
self.sm.put(self.pixels[8],8)
self.sm.put(self.pixels[9],8)
While the following does not
def show(self):
for i in range(self.num_leds):
self.sm.put(self.pixels[i],8)
time.sleep(self.delay)
Not too sure what the best way of solving this is ATM
Not sure that this will be solvable until DMA is implemented on MicroPython, but ideas welcome!
Have you tried putting a delay after the put? In the working example, there is time between the execution of the puts (the time it takes for the line being sent) In the failed example, there is no time between the execution of the puts. Only after all the puts have been executed. I don't have my pico yet, so I cannot try it myself.