I have PBcnt declared as:
int PBcnt=0;
The value only changes to PBcnt=1 when the pushbutton is pressed. How could the value in the serial monitor be anything different from 0 or 1?
//Global Variables
/
}
I have PBcnt declared as:
int PBcnt=0;
The value only changes to PBcnt=1 when the pushbutton is pressed. How could the value in the serial monitor be anything different from 0 or 1?
//Global Variables
/
}
This is my first post.
Please do not post useless pictures of code or error messages.
Use copy in the IDE and paste within code tags (<code/>
editor button).
Posting instructions can be found in the "How to get the best out of this forum" post, linked at the head of every forum category.
Based on the tiny snippet of your code presented, not possible. But since we don't get to see the whole picture, there's a myriad of 'I suppose' answers. Pick one out of a hat, or show us all your code. My pet theory right now is a pointer run amuck, but it's just a theory.
I appreciate the advice. I have added the code
Please remove the illegible screenshot and post output and a brief explanation of the problem.
What did you expect to happen, and what happened instead?
The problem is the integer values are either 0 or 1. But the serial monitor has them as 1359. For example, PBcnt goes to 1 when the Pushbutton is pressed, then calls on configureSteadyState(); and goes back to 0.
What would cause PBcnt to register 1359?
FYI, SP31cnt is a counter that should only go to 5.
Are you using a Mega?
I don't understand what you are seeing, but I would try PB on another pin. With the internal LED connected to pin 13, there is additional circuitry and it may be effecting the use as a push button input.
It looks like that took care of it! Thanks Cattledog.
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.