I think an array may work, I'm playing with it now.
To answer your question mark at the end of the message, essentially I have three sensors which need calibration and one button used to do the calibration. The three sensors calibration values are stored in variables (Data_Sen1, Data_Sen2, Data_Sen3). I wanted to write the code so it "loops" and which sensor you're calibrating is changed with a certian button push. I didn't want to write extra code for each sensor when I could do it in a loop.
The calibration flow is as follows:
-Enter the calibration loopsystem ready to cal sensor 1 (Data_Sen1)
cal direction set to up (increase value)
-if you push the button once, cal value increases by one.
-if you push the button twice, cal direction switches to down (decrease value)
-subsequent single button pushes decrease the cal value.
-if you push the button three times, the program moves onto the next sensor (Data_Sen2).
-push the button four times and we exit the calibration loop.
It looks like I could use sensor variables in an array such as Data_Sen[i] and alter the value of i as I move through the program.
I'm pretty sure I've used this before and just forgot, thanks for the reminder. I also recall that setting up an array such as:
Data_Sen var byte[3] would give Data_Sen[0] thru Data_Sen[2]. I'd need to setup Data_Sen var byte[4] if I wanted to use the numbers [1] -> [3]
Mark
Bookmarks