digitalWrite() — Maple v0.0.10beta Documentation

### Navigation

- next
- previous |
- LeafLabs |
- Index »
- Complete Language Index »

# digitalWrite()

Write a HIGH or a LOW value to a pin configured as OUTPUT.

## Library Documentation

void digitalWrite(uint8 pin, uint8 value)

  Writes a (digital) value to a pin.

  The pin must have its mode set to OUTPUT or OUTPUT_OPEN_DRAIN.

  Parameters: | `pin` - Pin to write to. `value` - Either LOW (write a 0) or HIGH (write a 1).
  See: | pinMode()

## Discussion

If the pin has been configured as an `OUTPUT` with pinMode() its voltage will be set to the corresponding value: 3.3V for `HIGH`, and 0V (ground) for `LOW`.

Because it is soldered to an LED and resistor in series, your board’s BOARD_LED_PIN will respond slightly more slowly as an output than the other pins.

## Example

The following example sets pin 13 to `HIGH`, makes a one-second-long delay, sets the pin back to `LOW`, and delays again, causing a blinking pattern (you could also use toggleLED()):

    void setup() {
      pinMode(BOARD_LED_PIN, OUTPUT);      // sets the digital pin as output
    }

    void loop() {
      digitalWrite(BOARD_LED_PIN, HIGH);   // sets the LED on
      delay(1000);                         // waits for a second
      digitalWrite(BOARD_LED_PIN, LOW);    // sets the LED off
      delay(1000);                         // waits for a second
    }

## See Also

- pinMode
- digitalRead
- BOARD_LED_PIN
- toggleLED()
- togglePin()

License and Attribution

Portions of this page were adapted from the Arduino Reference Documentation, which is released under a Creative Commons Attribution-ShareAlike 3.0 License.

### Navigation

- next
- previous |
- LeafLabs |
- Index »
- Complete Language Index »