diff options
| author | Marti Bolivar <mbolivar@leaflabs.com> | 2011-06-10 09:10:03 -0400 |
|---|---|---|
| committer | Marti Bolivar <mbolivar@leaflabs.com> | 2011-06-10 09:10:03 -0400 |
| commit | 4798d10e2bd178c4fb120635ef525cd0f592dc84 (patch) | |
| tree | 95813dd4c73e9a52882f4b150a0c2feb46ff757e /docs/source/lang/cpp/booleanvariables.rst | |
| parent | b078de0361d2b8db5d7195aaaf36103759e60963 (diff) | |
Docs: Use "BOARD_LED_PIN" instead of "13".
Fix examples where pin 13 was used explicitly instead of
BOARD_LED_PIN. Also change an AVR-specific example in
docs/lang/cpp/booleanvariables.rst to Maple conventions.
Diffstat (limited to 'docs/source/lang/cpp/booleanvariables.rst')
| -rw-r--r-- | docs/source/lang/cpp/booleanvariables.rst | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/docs/source/lang/cpp/booleanvariables.rst b/docs/source/lang/cpp/booleanvariables.rst index 0d76a12..e032c74 100644 --- a/docs/source/lang/cpp/booleanvariables.rst +++ b/docs/source/lang/cpp/booleanvariables.rst @@ -21,25 +21,20 @@ Example :: - int ledPin = 13; // LED on pin 13 - int switchPin = 12; // momentary switch on 12, other side connected to ground - // running is a boolean variable: bool running = false; void setup() { - pinMode(ledPin, OUTPUT); - pinMode(switchPin, INPUT); - digitalWrite(switchPin, HIGH); // turn on pullup resistor + pinMode(BOARD_LED_PIN, OUTPUT); + pinMode(BOARD_BUTTON_PIN, INPUT); } void loop() { - if (digitalRead(switchPin) == LOW) { - // switch is pressed - pullup keeps pin high normally - delay(100); // delay to debounce switch - running = !running; // toggle running variable - digitalWrite(ledPin, running) // indicate via LED - } + if (isButtonPressed()) { + // button is pressed + running = !running; // toggle running variable + digitalWrite(BOARD_LED_PIN, running) // indicate via LED + } } See Also |
