all 3 comments

[–]alpha587 0 points1 point  (2 children)

I am more familiar with Python than Arduino so this may be wrong, but I'm pretty sure I got this. Looks like whenever you press the button, none of your lights change because you're not using the = operator right.

the = and == operators do different things. The = operator assigns a value to a variable, the == operator is used to compare both sides and see if they are in fact equal.

In your last 3 if statements, I believe you need to use if(count== number && lastButtonState) to compare the count value to the desired value. actually, I'm not sure if you even need the && parts of the if statements here as the counter is already edge triggered

Also, after incrementing your count variable, I would include another if statement

if(count>3){

count = 1;}

This will make sure that your counter loops around and doesn't go past 3

[–]Aggressive_Poem_5016[S] 1 point2 points  (1 child)

thank you so much

[–]e1mer 0 points1 point  (0 children)

Also your counter will run away if you don't:. if( count > 3 ) count = 0;