[Microbit-Python] error code?... :(020

Damien George damien.p.george at gmail.com
Wed Sep 23 14:54:25 CEST 2015


Hi Alan,

Error code 020 is "out of memory".

The problem is as you guessed: there is an event put on the event
queue each time the button is pressed.  To clear this queue your code
needs to "yield".  You can do this by putting sleep(1) in your loop.

This is totally unexpected behaviour and I'll work out how to fix it
(Ie your code should just work).

Cheers,
Damien.



On Wed, Sep 23, 2015 at 4:02 AM, Alan <alainjackson at hotmail.com> wrote:
> Error code update.
>
> I'm consistently getting the ":( 020" code after 42 button presses (of any
> combination of buttons A and B).
>
> Is there a button click buffer that's overflowing somewhere? If there is I
> can't see a method on the microbit API to clear it.
>
> Cheers,
>
> Alan
>
> ________________________________
> From: alainjackson at hotmail.com
> To: microbit at python.org
> Date: Wed, 23 Sep 2015 00:28:51 +0000
> Subject: [Microbit-Python] error code?... :(020
>
>
> Hi,
>
> I wrote a small program to draw on the LED matrix, but after setting a few
> LEDs on I get what looks like an error message on the LEDs:
>
> ":(020"
>
> (Frowny-face zero two zero)
>
> It just keeps repeating that and my program stops but there's no stack trace
> on the python repl.
>
> Is that a built in hardware error code or something? Has anyone else seen
> that?
>
> Here's my program:
>
> ====8<====
>
> from microbit import *
>
> index = 0
>
> while True:
>     if button_a.is_pressed():
>         x = index % 5
>         y = int(index / 5)
>         display.image.set_pixel_value(x,y,
> not(display.image.get_pixel_value(x,y)))
>
>     if button_b.is_pressed():
>         index = (index + 1) % 25
>
> _______________________________________________ Microbit mailing list
> Microbit at python.org https://mail.python.org/mailman/listinfo/microbit
>
> _______________________________________________
> Microbit mailing list
> Microbit at python.org
> https://mail.python.org/mailman/listinfo/microbit
>


More information about the Microbit mailing list