Although I started off with machine code, then assembler many, many moons ago, I never really got into C/C++. Actually I skipped across to scripting (with a smidgin of Fortran that I don't remember), but I do have a fair mount of experience at that even at low levels. So please have patience with an old dude trying to push back the frontiers of ignorance on an hourly basis :-[
I've only started with the Arduino this week but am having great success building a control system for an aircraft cabin simulator (just a tiny one), so I'd like to get as proficient as possible. The Arduino is fast as compared to a PLC, which I need !!
My problem is that I can't work out how to do (what I would call) index looping.
The code I have works fine but is long due to repeating chunks of code that I would normally place inside an indexed loop. Meaning, I have similar code that must get processed but with, say, different inputs, outputs and maybe variables.
In scripting I would normally use an index loop such as;
//Declare the variables int foo1; int foo2; int foo3; int mVar1; myVar2; myVar3; int myOutput1; myOutput2, myOuput3;
//do the indexed loop. this is just a silly sample. for i = 1 to 3; put input (foo & i) into bar; bar = (bar + (myVar & i); put bar into (myOutput & i); next i
The closest thing I have found is to set up arrays, but that seems to be a complex solution to what I would have thought is a simple problem.
But, is there a simple solution? :-/
Can anybody help please ?
Many thanks, Bob...