Voting resources, early voting, and poll worker information - VOTE. ... Adafruit is open and shipping.
0

Memory error - from adafruit_crickit import crickit
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Memory error - from adafruit_crickit import crickit

by Sailindaze on Mon Sep 07, 2020 11:34 am

I'm running a feather M0 express and a feather Crickit.
I've updated both the feather and the crickit to the latest firmware, and all the libraries to the latest .mpy versions.

Here's the code I'm trying to run...
------------------------------
import time
from adafruit_crickit import crickit

while True:
print(crickit.touch_1.value)
time.sleep(0.25)
-------------------------------

And the error I get...
------------------------------
Traceback (most recent call last):
File "code.py", line 2, in <module>
File "adafruit_crickit.py", line 65, in <module>
MemoryError: memory allocation failed, allocating 158 bytes
--------------------------

All the memory error posts I've read talk about making your code smaller to fit into the available RAM, but in this case I think you can see there's not enough code for me to reduce.

I would appreciate any ideas

Thanks

Sailindaze
 
Posts: 5
Joined: Sun May 17, 2015 10:16 am

Re: Memory error - from adafruit_crickit import crickit

by dastels on Mon Sep 07, 2020 11:47 am

What build of CircuitPython are you using?

Feather M0 has a special build with Crickit support bundled in which takes far less memory, leaving more for your code. See https://circuitpython.org/board/feather_m0_express_crickit/.

Dave

dastels
 
Posts: 3430
Joined: Tue Oct 20, 2015 3:22 pm

Re: Memory error - from adafruit_crickit import crickit

by Sailindaze on Mon Sep 07, 2020 1:19 pm

Thanks, that was the piece I was missing. It's working now. I appreciate your help and apologize for the noob question.

John

Sailindaze
 
Posts: 5
Joined: Sun May 17, 2015 10:16 am

Re: Memory error - from adafruit_crickit import crickit

by dastels on Mon Sep 07, 2020 2:30 pm

Everyone starts with noob questions.

I'm glad to help.

Dave

dastels
 
Posts: 3430
Joined: Tue Oct 20, 2015 3:22 pm

Please be positive and constructive with your questions and comments.