You write functions for various things and call them from the loop. The loop is just the shell. I have written very useful programs for my photography, automating things like water drops, etc.
Clarify for those new to this stuff what you mean by "call them from the loop."
I have had 30 software languages. One H-1B wipes them all out. Lol.
True about needing an objective. Arduino is really a proof of concept, test board. A commercial product would be microprocessor based.
Idea => Requirements => Specification => Development => Test => Production