Boolean become false from true without logic

Hi, I have an arduino uno that drives a servo. I control it with a bluetooth app. Through of that I am able to rise or not some states. One example is "stepsin". Testing it, suddenly, a state becomes 0 and the sent order is no more permitted. I don't know why a boolean variable has to change so many times its value. indeed I don't know either how to solve it.
What I can do is this problem appears when I used a buffer
What is the cause of all that changes of stepsin? How can I solve it? Thank you for any interest

You are writing on memory outside your control array. I suspect that is what is corrupting stepsin. Remember that control has three elements: 0, 1 and 2.

Please explain me better. What s the meaning of writing on memory outside my control array? I really didn't expect that. thus I don't know what do you mean? How I shall writ inside?(if this is the solution)

Your code puts data in control[3]. It doesn't exist, but C doesn't check array bounds so it obligingly writes on the bytes past the end of the array, which is apparently where stepsin is stored.

You're superright @wildbill. I am shy right now because the error was so clear. thank You

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.