Closed Qata closed 2 weeks ago
Can you give some more information about what board you are using, and what C++ libraries/packages are required for building the C++? Are you using the Arduino IDE to do the final compilation?
Okay, it looks like the following commits in your TEA repo have been fixed by afd2f20 on the Juniper repo:
Could you elaborate more on the error you encountered in 1ce68b? Is the issue with the commented out code in the applyFunction
function?
Can you give some more information about what board you are using, and what C++ libraries/packages are required for building the C++? Are you using the Arduino IDE to do the final compilation?
Away from my laptop at the moment but I think its only dependence is the NeoPixel library, and any calls to that could be replaced with serial logging for debugging.
The range function I commented out I believe was because it also had a compilation error, and I commented it out because it wasn’t needed for the program to run, but I was going to need it later to send colors to pixel ranges rather than the entire line.
I was using an ESP32, and an UNO, just to check it wasn’t the board.
I was using the IDE to build the generated code.
That commit generated code from the compiler, but a tuple function was missing its initialiser. When I added an empty one (not sure if that was the right thing to do, I’m not a C++ user), the IDE was able to compile the code, but the run loop didn’t run.
Pretty certain I added logging which I didn’t commit, since I reasoned that if I’d messed up the tuple init, I was going to need your help.
Can’t test it at the moment, but looking at the code, firstAction
sets line ‘1’ to blue, and there is no line ‘1’, only ‘0’.
So keep that in mind if you do test it against actual NeoPixels.
Is the issue with the commented out code in the applyFunction function?
Sorry I missed this. No, that was an issue, but definitely not the main one.
That commit generated code from the compiler, but a tuple function was missing its initialiser. When I added an empty one (not sure if that was the right thing to do, I’m not a C++ user), the IDE was able to compile the code, but the run loop didn’t run.
Yes, the lack of a zero arity default constructor was an issue. The zeros function creates an array of tuples, but if there is no default constructor, C++ doesn't know how to initialize the elements of the array. If you're using the zeros
function, you should also know that there was a bugfix for zeros
on the develop
branch in commit 21e1ed that is not in 4.0.0.
I briefly looked through the rest of your code. I've found that in some of the Adafruit libraries the top level objects (in this case Adafruit_NeoPixel) do not work with new
. Instead, top level objects must be declared as global variables. Juniper has support for this particular use case where you can declare globals inside of ##
at the top level. I know this is definitely the case with the Adafruit Arcadia libraries. Perhaps NeoPixels are okay to use with new? I do not recall.
I also didn't see your code calling the begin
function, which is probably required for the NeoPixels. See the NeoPixel example from Adafruit here: https://github.com/adafruit/Adafruit_NeoPixel?tab=readme-ov-file#simple
Thank you for the help! I've got it to a running state. I'll open more specific issues if anything else crops up.
Hello!
I love the idea of an ML on Arduino, and am not exactly a fan of C++, so I tried to write a dynamic light-control system with it, which implemented an approximation of The Elm Architecture as its main run-loop.
Unfortunately I kept running into compiler errors I had to work around, and even when I did work around them, the C++ it generated was invalid, and then even when I edited that by hand, the program didn't run.
Attached is a zip of the project, the comments on the git commits denote when I ran into crashes and errors.
The most up-to-date commit builds but the generated code is not valid.
TEA.zip