Thanks for the responses!!
Quote:
can I mix LCD instructions with int arguments
Not sure what you mean by that - can you explian, please?
@Groove, I think you kindly gave me the anser to that question in your first two lines with;
,
One function, one return value, irrespective of the number of arguments.
I was thinking of something like; get a keypress from a button, do a calculation on some variables and display something on the LCD as each of the previous steps took place.
I dont know the correct vocabulary but a 'subroutine' might have been what I think I meant(?)
I'm now thinking that it would be something more like individual functions for;
update LCD
get button press
debounce button
get variable from sensor 1
get variable from sensor 2
update LCD
calculation on variables
update LCD
Rather than jamming all of that into a single function - which now I write it out like that looks like a nightmare.
Generally speaking, you want to extract code that is duplicated and turn it into a function.
ok, I understand that. If there's no "exact" duplication in a couple of loops in a sketch, perhaps only 60% is dulpicated the way it's currently written (better practice question again) do you rewrite in such away that the duplicated parts CAN become a function, and the non duplicated parts, either do or dont become different functions?
The simplified model I have in my head is of building blocks... you can spell any word you want, if you have the blocks with the right letters on them. I guess I'll understand this much better after doing it!
automatic variable
Whoa!! ..I can't find anything about these things in the usual places I tend to look, do I need to know what they are (if only to avoid the variable Police visiting)?
My head is starting to hurt again and I've only just got all the blood off the walls 