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.
Is obstacle >2m away? (CheckDistance)
//then goes to CheckDistance
IS incline >20Degrees? (CheckIncline)
// goes to CheckInline
Read (ultrasound sensor etc)
atan(theta) -- // some function