Sunday, March 7, 2010

Task 31:

31) Change the above program by reversing the the way the led goes on/off when the button is pushed/not pushed. Publish your program with a suitable comment.

This is the same as the last one, the only code that needed to be changed was the HIGH/LOW states in the if statement.

if (buttonState == HIGH) {
// turn LED on:
digitalWrite(ledPin, LOW);
}
else {
// turn LED off:
digitalWrite(ledPin, HIGH);
}
}

No comments:

Post a Comment