bbcmicrobit / bbcmicrobit/micropython

MicroPython consumes too much memory and causes memory allocation error on V1 micro:bits

Open
#784 5 comments 0 reactions 0 assignees View on GitHub
Dominant language
C
Stars
646
Forks
290
PR merge metrics
No merged PRs in 30d

Description

**Describe the bug**
Using the micro:bit Python Editor, we were trying to add servo and LED functionality to the Kitronik MOVE Motor MicroPython library. Upon adding the servo code (about 20 lines of code) the code is now too big and when put on the V1 micro:bit it causes a memory allocation error saying memeory allocation failed, allocating 398 bytes.

**To Reproduce**
Steps to reproduce the behavior:
1. Open https://python.microbit.org/v/3/project
2. Save [KitronikMOVEMotor.py](https://github.com/DaveAtKitronik/micropython-microbit-kitronik-MOVE-motor/blob/master/KitronikMOVEMotor.py)
3. Add the code at [MOVEMotor.py](https://github.com/DaveAtKitronik/micropython-microbit-kitronik-MOVE-motor/blob/master/MOVEMotor.py) to main.py
4. Download the code onto a V1 micro:bit
5. The error `memory error, memeory allocation failed, allocating 398 bytes` appears

**Expected behavior**
Following the same steps on as above but the program works on a V1 micro:bit.
On a V2 micro:bit then the code works as expected.

**micro:bit version**
V1 micro:bit

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.