I have this simple code and I can not figure out why I keep getting double red flashes. I have downloaded the latest bundle and I moved
the latest files (as far as I can tell). Specifically: D:\lib\adafruit_circuitplayground\circuit_playground_base.mpy and other mpy files including bluefruit.mpy and express.mpy. I have tried different sets of code and multiple boards.
I thought there might be some bad characters, neither Mu or Visual Studio Code have complained. I do not trust Mu because it does weird stuff including hanging when I was trying to use it last( I had to reboot to get it to go away). I keep wondering why it is recommended when it is so flakey.
and it is unresponsive? If I exit Serial and reenter it, I am back to the same strange information. If I do a Ctrl-C it goes back to the normal REPL interface/interaction. I can put code in and it accepts it?
Visual Studio Code (VSC) still underlines adafruit_circuitplayground and says that it could not be resolved. I can change the code.py and store it back on the circuitplayground and the updated code works.
I can go back to doing coding so you can probably close this. I would welcome any suggestions about how to get rid of the weird output in Mu and why VSC can't resolve "import adafruit_circuitplayground could not be resolved"
The weird output in the Mu serial window is the "status bar". It has escape codes in it that change the title of a terminal window. Mu normally ignores this, but if Mu opens the connection late you may see part of it.You can just ignore it, or you can turn it off: https://docs.circuitpython.org/en/lates ... .StatusBar.
The "not resolved" error is just VSCode not knowing about the Adafruit libraries. It is not really an error in the program. There are ways to inform VSCode about the libraries, but I am unfamiliar with that. Some people in our discord (https://adafru.it/discord, channel #help-with-circuitpython) may be able to help.
Thanks very much for the clarification on both issues, but...
I went back and tried loading some PWM code (provided by ChatGPT Plus) and ran into a related error to the earlier one and I ended up with the red flashing lights. When I went into the REPL and loaded the import by hand, I see this
>>> from adafruit_circuitplayground import cp
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: no module named 'adafruit_circuitplayground'
on the board:
Directory: D:\lib\adafruit_circuitplayground
I was expecting to see just a circuit_playground.mpy.
Now I assume that the adafruit_circuitplayground in the import is pointing to the directory in lib and not the mpy files?
I went back to some previous code, saved it to the board and it ran, but when I tried again to do an insert "from adafruit_circuitplayground import cp" by hand Iin the REPL I get the same error message as earlier even though the code is running?
>>> from adafruit_circuitplayground import cp
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: no module named 'adafruit_circuitplayground'
>>>
Am I still missing something or doing something wrong?
Now I assume that the adafruit_circuitplayground in the import is pointing to the directory in lib and not the mpy files?
An `import` can import a single .py or .mpy file, called a "module", or it can import a Python "package". A package is a directory whose name you use in an import statement. If you just import that package, it runs what is in `__init__.py`.
Could you tell me which board you are using? Is it a Circuit Playground Express or Circuit Playground Bluefruit? Are there any other boards plugged in? Just to make sure, is the D: drive CIRCUITPY ?
I also had a Trellis plugged and when I removed it the, REPL in Mu stopped complaining.
I then plugged them both in and generated the error again in the Mu REPL.
Having two boards plugged in at once can be confusing to Mu. Make sure that lib/adafruit_circuitplayground is on the CPX (Circuit Playground Express) CIRCUITPY. Is it possible you might have copied it to the NeoTrellis as well?
Also note that the adafruit_circuitplayground library is compiled in to the firmware on the CPX. So you don't even need to put it in the lib directory. If you can't import it, I'm thinking that you might have been talking to the other board instead of the CPX.