If this is a 'general question' then please move.
Ok, I am new to Arduino but open to constructive criticism. I've been working on this for quite a bit. The overall goal for this project is a collision avoidance system for a golf cart. I am using three sonar sensors and an LCD with keypad for a display. I want the LCD to display in real time the speed of the cart and the current charge state of the golf cart. The LCD will also display a menu to change a few options: speed units, warning buzzer on and off, automatic brakes on and off (haven't made it that far into the project but went ahead and built this option into the menu).
At this point I'm still in the prototyping stage. I'm simulating the speed and voltage with two potentiometers.
I started off with two separate programs, one for the sensors and warning system and the other for the LCD. I'm to the point where I am putting the two programs together and now I'm having some issues. With the way I have the program written now, the LCD doesn't display in real time. I'm able to see the main display, and I'm able to go into the menu to change units of speed and turn the buzzer on and off, but the voltage reading isn't real time. It only updates when I leave the menu to go back to the display.
I think the issue is the display doesn't print in the loop, it prints in a separate function. Adding that function to the loop causes all kinds of issues. The LCD doesn't display correctly, I believe it is having issues keeping up with the loop. Adding a delay to the loop fixes this, but it throws off the sonar sensors. Adding the function to the loop also does not allow me to visit the menu to change settings, as it is always displaying the main display.
I'll try to post my code, may have to separate it into a couple posts due to length. Let me know if you see any simple fixes that do not require me to completely rewrite my code. If that's the case, I'll probably cry. It has taken weeks for me to get to this point.