The version and config is Adafruit CircuitPython 7.3.1 on 2022-06-22; Adafruit CircuitPlayground Express with Crickit libraries with samd21g18
Board ID:circuitplayground_express_crickit
We're using Mu Editor IDE.
I've tried many iterations of debugging and can't find a pattern, sometimes it just works and other times I get a memory allocation error:
Code: Select all
Traceback (most recent call last):
File "main.py", line 26, in <module>
MemoryError: memory allocation failed, allocating 512 bytes
Code: Select all
import time
from drivetrain import Drivetrain
from adafruit_circuitplayground import cp
import audioio
import audiocore
import board
import neopixel
drivetrain = Drivetrain()
num_pixels = 15
pixels = neopixel.NeoPixel(board.A1, num_pixels, brightness=1, auto_write=False)
cp.detect_taps = 1
wavfile = "SCREEEEEAM.wav"
f = open(wavfile, "rb")
wav = audiocore.WaveFile(f)
a = audioio.AudioOut(board.A0)
while True:
drivetrain.forward()
pixels.fill((0,255,0))
pixels.show()
if cp.tapped:
pixels.fill((255,0,0))
pixels.show()
a.play(wav)
drivetrain.stop()
drivetrain.back()
time.sleep(1)
drivetrain.right()
time.sleep(1)