Please Read how to use the forum. Especially the part about code tags, posting a complete program and posting the complete error!
But I can tell you, BOTH statements are wrong. The byte keyword tells the compiler to create a NEW variable which is initialized to an unknown value. So pretty useless to make a comparison against that. If you want to check against an already initialized variable called 'counter', drop the byte keyword.
thanks for the quick reply. It compiled atleast. but it doesn't work as planned. heh. any suggestions? It seems to cycle thru the byte counter entirely at the press of my button
You still have the same problem in other places. This line:
avender:
byte counter = counter + 1;
Creates a variable named counter that is local to the if statement. If you wanted to change the value of the global variable named counter, then you need to remove the "byte".
You're adding to it whenever the button IS pressed. The Arduino can run that loop thousands of times between the time you press and release the button. Instead you need to react just once when the button BECOMES pressed, or is pressed now but wasn't last time. See the "State Change Example" for how.
BTW: I notice you have your buttons reading HIGH when pressed. That's backwards of how we normally do it. Normally you would wire up so that it connects to ground and reads LOW when pressed. That way you can use the internal pull-up resistors with pinMode INPUT_PULLUP and you don't need external resistors for your button. I know newbies like for HIGH to be the same as ON but in the real world it isn't always that way.
avender:
Im not sure I completely understand how button to ground works. But thanks for the advice.
What's to understand? Instead of connecting the button between the pin and 5V you connect between the pin and ground and then you don't have to have a resistor for the button because you can use the ones built into the chip.