Does anyone bother with creating an Algorithm before writing their code? What really is an Algorithm in the context of programming? I might be thinking of something different.
I'm trying to determine the programming approach for addressing more than one objective, and my limited programming experience makes it difficult to envision how the routines should be defined and called.
What I want to do is create a sweep frequency generator. The generator will have two modes, CW and Sweep. The setup parameters will be controlled by a single rotary knob and momentary button.
At boot, the generator starts in a default condition, CW @ 10 MHz output (set via setup).
When the button is pressed, it toggles through various settings, and the knob changes the value. The settings are not only changed in the code, but are also sent to an LCD where the cursor will blink at the selected parameter:
Mode (CW or Sweep)
Frequency decade value (toggles through each decade, then to mode)
Step decade value
The open parameter will expire after a few seconds.
Each of these pieces I can do individually in a simple loop, but I'm not sure how to accomplish these all together.
For example, I have programmed the generator for a CW frequency within a loop that monitors the rotary encoder, and can change the value a fixed amount with the encoder. I can write a loop that sweeps frequency between hard coded start and stop frequencies and step size, but have not yet added the encoder.
The hard one now seems to be when the generator is sweeping, I push the button to change the start frequency, and the knob adjusts the start while sweeping.
Anyway, rather than go the brute force way and start coding, it seems it would be more efficient to script a higher level program outline as a development guide. Something to define what should be standalone functions, what goes in the main loop, which variables need to be global, etc...
I'm likely to spend a lot of time writing some seriously messy and inefficient code if I just started cold now.
Any tips on how to start?