arduino/Arduino — pull request #1800 by ionut97 (2014-01-11 19:43:51+00:00)
Title: Toggle function

Hi!
I added a toggle function which I thought will be useful.
The function has a default parameter (true) and the first is passed by reference.
I thought it will be useful to change the toggle a boolean variable when a button is pressed.

Exemple:
bool state = false;
int button = 5;

void setup(){
pinMode(button, INPUT);
}

void loop(){
toggle(state, digitalRead(button)); // start/stop button
if(state){
//action ...
}
}

Thank you!