[SOLVED] witch from 0 to 1 to 0 to 1, ... using 1 button

Hi, so I've got a simple question. Basically, I want to change number on a variable from 0 to 1 to 0 to 1, ... using only 1 button.

Take a look at the state change example code in the IDE's examples.

See the StateChangeDetction example in the IDE

Detect when the button becomes pressed rather than when it is pressed

Incidentally, did you choose to post your question in this forum section or was it an accident ?

Hi, thank you for solving this.
Yes, I meant to post this in this section.

Why? Is your question in any way related to the Arduino command line tools?

Because, I wanted to know the command for it.

OK, the "Arduino command line tools" category is only to be used for topics specifically about the command line development tools such as Arduino CLI or Arduino Lint. So a topic about the code used in Arduino sketches is off topic here.

Questions about code should be be made in the "Programming Questions" category. I have moved your topic there. Please make sure to use that category for any future questions on the subject of programming. Thanks!

Ok, I'm kinda new to the forums and I didn't know there was a category "Programming questions". Next time I'll make a post there.