Hello,
I am programming a robot and I need it to do various 'things'.
There is a main loop (void loop) which it will run over and over - like usual.
but my question is, as I think it will simplify it and make it easier to write/understand, how I create small 'sub codes' that can be called upon?
Literally just the naming of a sequence and how to jump in between them.
For example-
Is obstacle >2m away? (CheckDistance)
//then goes to CheckDistance
IS incline >20Degrees? (CheckIncline)
// goes to CheckInline
CheckDistance:
Read (ultrasound sensor etc)
Write( Etc)
CheckIncline:
Int theta
atan(theta) -- // some function
thanks
harry