Syntax: REVERSE Pin
Reverse the data direction of the specified pin.
* Note: expressions are not allowed as arguments on the BS1. The range of the Pin argument on the BS1 is 0–7.
|BS1 and all BS2 models|
Reverse is convenient way to switch the I/O direction of a pin. If the pin is an input, Reverse makes it an output; if it's an output, Reversemakes it an input.
Remember that "input" really has two meanings: (1) Setting a pin to input makes it possible to check the state (1 or 0) of external circuitry connected to that pin. The current state is in the corresponding bit of the INS register (PINS on the BS1). (2) Setting a pin to input also disconnects the output driver, the corresponding bit of OUTS (PINS on the BS1).
The example programs illustrate this second fact with a two-tone LED blinker, using the circuit below:
BASIC Stamp Help Version 2.5.4
Copyright © Parallax Inc.