PubInv / moonrat

Moonrat: A second-generation portable incubator
GNU Affero General Public License v3.0
3 stars 3 forks source link

Arduino R3 is incapable of running current Fuzzy Logic code #305

Open RobertLRead opened 1 month ago

RobertLRead commented 1 month ago

Probably because of memory.

It is very clear that just by uncommenting certain code, which is not executed until AFTER the OLED is initiated, we can prevent the OLED from initiating. This is code that allocates the "Fuzzy" objects.

I conclude that the Fuzzy logic will run on an R4, but not on an R3.

However, that analog temperature read basically doesn't work on an R4. (It is not clear to me that it works on an R3.)

So we are stuck. I am going to implement a PID controller on an R3; I believe there is a high probability that that will work, but I will check all the hardware features (esp. the temperature read) first.

ForrestErickson commented 1 month ago

Lee experimenting with Wokwi simulating the MoonRatIi on an R3

See: https://wokwi.com/projects/405744143993619457

I am worried I am not using the same code as is Robert.

Simulation Compiles with Fuzzy Logic, OLED begin error.

At run time I get an error "Error while initializing OLED" Screen shot image

Notes on code changes to R3

In the code I have:

changed within the code the #define for R3

// Set controller type here

define R3 //Uncomment for Arduino UNO R3

//#define R4 //Uncomment for Arduino UNO R4>

When I do so the code compiles so I conclude that running the Fuzzy Logic code is possible.

I have compared and contrasted the code which I believe to be initializing the OLED and do not find differences against examples which compile and run.
Here is one such example: https://wokwi.com/projects/405917918926102529

Because I saw it in other code examples I found, I added the line: "#include "

in Setup(), I have commented out some IO pin initialization for heater and buzzer that was before the OLED setup.

However, the run time "Error while initializing OLED" remains.