2016-03-25 16:47:20 -07:00
# Digital Write Pin
2016-04-13 08:27:45 -07:00
Write the value ``0`` or ``1` ` to the specified (digital) [pin ](/device/pins ). **Some pins are also used by the display, read the [pin documentation ](/device/pins) carefully.**
2016-03-25 16:47:20 -07:00
```sig
pins.digitalWritePin(DigitalPin.P1, 1)
```
### Parameters
* name - the pin name (``P0``, ``P1``, ``P2` `, ...)
2016-04-13 08:27:45 -07:00
* value - [Number ](/reference/types/number ); 0 or 1
2016-03-25 16:47:20 -07:00
### Example: football score keeper
The following example reads `P0` to determine when a goal is scored. When `P0 = 1` , the code uses `digital write pin` to play a buzzer sound:
```blocks
let score = 0
basic.showNumber(score)
basic.forever(() => {
if (pins.digitalReadPin(DigitalPin.P0) == 1) {
score++;
pins.digitalWritePin(DigitalPin.P2, 1)
basic.showNumber(score)
basic.pause(1000)
pins.digitalWritePin(DigitalPin.P2, 0)
}
})
```
### See also
2016-04-13 08:27:45 -07:00
[micro:bit pins ](/device/pins ), [digital read pin ](/reference/pins/digital-read-pin ), [analog read pin ](/reference/pins/analog-read-pin ), [analog write pin ](/reference/pins/analog-write-pin ), [on pin pressed ](/reference/input/on-pin-pressed ), [pin is pressed ](/reference/pins/pin-is-pressed )
2016-03-25 16:47:20 -07:00