Hi all, I am running a loop that should find the max value. The condition should check to see if the current XAccel value is greater than the previous value of the array, and if it is move to a second if statement that determines if it is greater than the current max value, and replace it if it is. The problem is that the max value is being replaced even when the current XAccel value is lower. I am too nooby to know what I am doing wrong, any help would be much appreciated.
The problem may be in the part of the code that you did not provide. Always provide complete programs or at least a complete example that exhibits the problem.
When posting code, use the autoformat function of the Arduino IDE, and post the entire program inline between code tags.
An if statement does not have to have an else portion.
x=x has no effect except to waste your effort in typing it.