I'd like to switch between 2 states each time a function runs. The best way I can think of doing this is using a bit variable and incrementing it at the end of the function, but it seems one can't define a bit variable in arduino like in C.
Whats the next cleanest way to do this? Incrementing if its 0 and decrementing if its 1 seems pretty cumbersome.
void FlippyFunction( void )
{
static boolean state = false; // or "= true;"
if ( state )
{
// Your code goes here
}
else
{
// Your other code goes here
}
state = ! state;
}