Error on Raspberry Pico with Micropython #13627
Replies: 1 comment
-
I assume the code simply runs out of memory caused by memory fragmentation. The code looks extremely inefficient. It looks as if all the functions could collapse into one, and these large bytes([.....]) objects should be coded differently as a single bytes object, like e.g. instead of bytes([0x01, 0x02, 0x03]) use b"\x01\x02\x03". The latter is a constant which is created at compile time, the former requires allocation and operation at runtime. As a next step, the b"...." objects can be put into a table or dictionary and indexed, reducing the need to have a function for each of them. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi, I am trying to turn on Backlight by using Raspberry Pi Pico with Micropython.
(MicroPython v1.22.0 on 2023-12-27)
Here is the program code that I wrote:
https://paste.fastmirror.net/?21e7962789b05236#CqRgdAN3ujHtihMmX99bipR39oxd2bEsHpMNCJ4DbMgY
However, when I run this code, then it shows :
MemoryError: memory allocation failed, allocating 228 byte
Could anyone tell me how to deal with this error?
Beta Was this translation helpful? Give feedback.
All reactions