Hi,
I am using Gabriel Bianconi Wiichuck library. Thanks Gabriel. I am a complete noob and am trying to put an if statement into my program. Here is my code.if(nunchuk.cButton == 1);{Serial.println("1234567890");}
when I upload this "1234567890" prints every time. It does not matter if nunchuk.cButton is pressed it just prints "1234567890". Please help.
Live Long and Prosper
1001100111100
You have a semicolon after the if statement that needs to be removed.
if(nunchuk.cButton == 1)
{ Serial.println("1234567890") }
Removed out of place ';'
if ( nunchuk.cButton == 1 ) { Serial.println("1234567890"); }
Well that was easy. Thank you so much. I love these quick replies.
Do us a favour too and provide a better title next time, one that covers your question.
Thanks,
Rob
And do yourself a favour by formatting the code differently so that such problems are easier to spot
if ( nunchuk.cButton == 1 );
{
Serial.println("1234567890");
}
The stray semi-colon is much easier to when formatted like that.