so, in my code I've got 3 pins, lets call them WidgetPin1, WidgetPin2, WidgetPin3. These are then read into the adc to produce WidgetRead1, WidgetRead2, WidgetRead3 (you might be able to spot a trend here).
When the code is running, a number of operations are performed, first widgetpins 1-3 are analogRead into the adc by 3 separate statements, then the resulting widgetread values have a few maths operations performed on them.
At the moment the code looks similar to (its all pseudo code, since the code I've written is confusing/messy/amateur);
<routine to get adc values>
widgetread1=analogread(widgetpin1)
widgetread2=analogread(widgetpin2)
widgetread3=analogread(widgetpin3)
<routine to do funky maths and clever stuff>
widgetread1=float(widgetread1*cleverstuff)
widgetread2=float(widgetread2*cleverstuff)
widgetread3=float(widgetread2*cleverstuff)
<routine to print results to lcd>
setcursor 0,0
print preface text
print widgetread1
setcursor 0, 30
print preface text
print widgetread2
setcursor 0, 60
print preface text
print widgetread2
So, it all looks very mechnical and Im wondering if theres a way to clean it up using for loops with the variable names automatically incrementing. The cursor position bit seems easy enough, its stumping me on autoincrementing the variable names.
Anyway, to me it seems logical (you might spot early onset insanity in this statement) and something others are bound to have come across. Over to you guys (and gals of course).