# OUTPUT

INPUT / OUTPUT Examples

Syntax: OUTPUT Pin

## Function

Make the specified pin an output.

- Pin is a variable/constant/expression* (0 - 15) that specifies which I/O pin to set to output mode

* Note: expressions are not allowed as arguments on the BS1. The range of the Pin argument on the BS1 is 0–7.

## Quick Facts

| BS1 and all BS2 models
Related Commands | INPUT, REVERSE

## Explanation

There are several ways to make a pin an output. Commands that rely on output pins, like PULSOUT and SEROUT, automatically change the specified pin to output. Writing 1s to particular bits of the variable DIRS makes the corresponding pins outputs. And then there’s the OUTPUTcommand.

When a pin is an output, your program can change its state by writing to the corresponding bit in the OUTS variable (PINS on the BS1). For example:

      OUTPUT 4
      PIN4 = 1

      OUTPUT 4
      OUT4 = 1

When your program changes a pin from input to output, whatever state happens to be in the corresponding bit of OUTS (PINS on the BS1) sets the initial state of the pin. To simultaneously make a pin an output and set its state use the HIGH and LOW commands.

Go to Welcome page

BASIC Stamp Help Version 2.5.4

Copyright © Parallax Inc.

8/8/2012