Hi,
I have made a couple of Arduino project and this one is not much more complicated,
however it contains of some more relays and light barrier sensors. It is for controlling some modellcars in a model railway and some other things (through relays). I have been struggling the last days with the program resetting/running setup again.
I would appreciate some new eyes on this. :o
best regards Johan
So far, as I am in testing and programming process, I supply the Nano with USB to check Serial output. The serial output will in production be shut of, and I will power Vin with 9v Mean well. That is what I have done to other projects. All sensors, relays etc. are of course powered by Mean Well 5 v stable power even right now. Everything connected with gnd.
Arduino Nano
Sketch uses 7406 bytes (24%) of program storage space. Maximum is 30720 bytes.
Global variables use 321 bytes (15%) of dynamic memory, leaving 1727 bytes for local variables. Maximum is 2048 bytes.
What happens?
When running the main part "carControl" it sometimes restart in case "MEETING". That is why the if statements checking sensors are out commented - maybe they makes the running hang up.
Sometimes the program freeze and restart, and so does the Serial Monitor output. And sometimes, it goes so quick and the program seems to continue its running (but the Serial text in setup is shown).
Some notes
- Most strings in "F()".
- I plan to use a LCD but this code is commented out and no LCD is connected due to I am doing trouble shooting and want to remove potential error sources. That is also why some other code are commented out. I have tried with/out the hand full of LCD-commandes in code that is not commented out. It still apperas to be problems.
- I have tried changing US ant checking the power supply so I do not think it is hardware?
- I have implemented a temporary internal LED for testing the program with out serial prints, and sometimes is freeze.
I have also tried to get an analyze here https://sparks.gogo.co.nz/avr-ram-use.html
Code attached!
Minnesanalys 2021-03-25.txt (5.78 KB)
Lidhult_Bilbana_1_v2_DEV.ino (41.1 KB)