REVERSE

BS1 icon BS2 icon BS2e icon BS2sx icon BS2p icon BS2pe icon BS2px icon

REVERSE Examples

 

 

 

Syntax: REVERSE Pin

Function

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.

Quick Facts

  BS1 and all BS2 models
Related Commands

HIGH, TOGGLE

Explanation

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:

 

Go to PBASIC Language home page

Open Getting Started with Stamps in Class

Open Connection Troubleshooting

BASIC Stamp Help Version 2.5.4

Copyright © Parallax Inc.

8/21/2013