If statement sets value to 274... should set to 0
realolman1
Posts: 55
I have a 1 second timing loop that inserts a value into an array 1 per second.
The first time through it works ok, but when it reaches 1441, it should reset to the array element to 0 ... instead it resets to about 274 or so... I'm not sure exactly.
So the first 273 or so elements never change value, but stay the same as what they were the first time through... all the rest are replaced with the correct values
What is wrong?
thank you
The first time through it works ok, but when it reaches 1441, it should reset to the array element to 0 ... instead it resets to about 274 or so... I'm not sure exactly.
AnalogRecord[RecordCount++]:=value 'here to fill array element 1/sec 'Should reset to 0 HERE ... resets to about 274???? if RecordCount==1441 RecordCount:=0
So the first 273 or so elements never change value, but stay the same as what they were the first time through... all the rest are replaced with the correct values
What is wrong?
thank you
Comments
You need to change the code to: because that is already past the end of the array (0-1439).
BTW... you should used a named constant for pin 17 instead of a literal as you're doing.
the LED is just so I can tell if the thing is running the program... I had trouble with resets when plugging and unplugging the serial cord ( which I understand now ) .. but thanks for the tip.
You guys don't miss much do you?
thanks again
And sapphire... ... absolutely the way to do it
thank you both very much