giuliomoro
Thank you!
The command only needs to be called once during runtime.
So is it possible to run both a 'render.cpp' and a '_main.pd' on the board? Or is there another way to run C++ code?
As previously mentioned this worked fine in another project:
float gCount = 0;
void logCount(const char* filename, float data) {
std::ofstream outputFile(filename, std::ios::app);
if (outputFile.is_open()) {
outputFile << data << std::endl;
outputFile.close();
}
}
void cleanup(BelaContext *context, void *userData)
{
logCount("log.txt", gLogCount);
}
EDIT:
I found the info about combining Pure Data and C++ and the 'custom-render' example in the IDE.
But I'm having a hard time finding out how much of the provided C++ in this file, that I need to keep in order to pass a value from the PureData and call the above 'logCount' function on cleanup.
I basically need a custom render.cpp that runs the script from render() after a counter surpasses a certain value:
system("/root/Bela/scripts/halt_board.sh");
And this to run at clean up with float(s) coming in from the _main.pd:
float gCount = 0;
void logCount(const char* filename, float data) {
std::ofstream outputFile(filename, std::ios::app);
if (outputFile.is_open()) {
outputFile << data << std::endl;
outputFile.close();
}
}
void cleanup(BelaContext *context, void *userData)
{
logCount("log.txt", gLogCount);
}