adafruit / Adafruit_CircuitPython_IRRemote

CircuitPython drivers for IR remote send and receive
MIT License
29 stars 34 forks source link

MemoryError when trying to run IR sensor examples #22

Closed pllim closed 5 years ago

pllim commented 5 years ago

I encountered MemoryError trying to run cpx_ir_receive.py or cpx_ir_transmit.py on the circuit boards that was circulated at PyCon 2019 (the red one in swag bag and the black one from tin box). I was told that this is a known issue but I can't find it in this repo, hence I am opening this issue. If there is already another issue for this problem, please cross link here and close this issue.

p.s. Also tried sprinkling gc.collect() calls in the scripts but it didn't help.

kattni commented 5 years ago

I think this is due to using the .py version of the library vs the .mpy version. Using the .py version can cause this issue. These examples were tested by multiple people without issue, so I suspect it may have been related to using the .py library files. Please verify that you are using the compiled version from the Adafruit CircuitPython library bundle. Thanks!

pllim commented 5 years ago

Thanks for the reply! In my case, I set up the chip using https://github.com/adafruit/PyCon2019 instructions. How do I copy the compiled .mpy file over? Do I really need to go through the entire build from source thing at https://circuitpython.readthedocs.io/projects/irremote/en/latest/#building-locally ?

dhalbert commented 5 years ago

Just download the appropriate bundle from the link above, unzip it, and find the adafruit_irremote.mpy file in the lib directory. Copy it to your CIRCUITPY at the top level or in the lib directory, Make sure there is no adafruit_irremote.py anywhere. See https://learn.adafruit.com/welcome-to-circuitpython/circuitpython-libraries for more information.