So I was going trough TPixy.h file and noticed that inside the constructor, as well as resize(), malloc() and realloc() are called.
I was wondering if you could suggest a quick fix to avoid dynamic memory allocation. My arduino program freezes after awhile and I believe this is due to the fact that the memory is being dynamically allocated and eventually the memory gets divided and fragmented in a way that new data cant be stored
I tried tweaking the library a bit, the code compiles but doesnt run
Also, I wasnt able to construct/deconstruct a pixy object for some reason. I tried to temporarily clear up some memory on my chip
I declared PixyI2C pixy; before void Setup(){}; then inside of a setup loop I would do pixy.init();
later in a program, I had a method which did this:
@
if( (millis() - last_camera_reset) > 10000){
pixy.~PixyI2C(); //clear up memory, destroy camera object
PixyI2C pixy; //and then create it again
pixy.init();
last_camera_reset=millis();
}
@
essentially i tired to remake pixy object every 10 seconds but that didnt work, it appeared that the camera would stop communicating with the arduino
Thanks!