Skip to content

"run in background" code behaviour changes after adding neopixel-library #55

Description

@kryt

Neopixel-library seems to malfunction and cause issues with the internal mechanics of the microbit, if pause or forever-loop is not used.

Without neopixel-library:
When writing a code inside "run in background", and having everything inside a while(true), the code is reacting to button-presses and keeps track of time by using millis. For example, pressing a button that turns on a LED in e.g. pin1 for few seconds works fine.

However, after adding the neopixel-library and changing the code to use neopixels instead of LEDS breaks the functionality with reading pins and buttons. This extends to the radio as well, which ceases to work.

Curiously, inside "run in background" while(true), neopixels do work with millis alone. It is so far only when buttons/pins are used, or the radio is used, that the behaviour breaks.

Finally, if one adds pause(0) or moves the code to forever-loop, the code works and there are no issues (other than a very slow code due to the microbit itself). This, however, slows down the code to the point of being useless for reactive interactions.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions