PASCO Xplorer-GLX Users’ Guide User Manual

Page 57

Advertising
background image

X p l o r e r G L X U s e r s ’ G u i d e

51

Special Functions

These special functions do not directly control output, but can be useful in com-
bination with the output-control functions.

limit(min, max, x)

The limit function is used keep a varying value within a

specified range. The function has three arguments: min, max, and x.

If x

< min, then limit(min, max, x) = min.

If x

> max, then limit(min, max, x) = max.

If min

x max, then limit(min, max, x) = x.

mod(numerator, denominator)

The mod function is equal to the remainder

when numerator is divided by denominator. The arguments numerator and
denominator can be any number (not just whole numbers). If denominator = 0,
then mod(numerator, denominator) = 0.

abs(x)

The abs function is equal to the absolute value of its argument.

random()

The random function equals a randomly generated number between 0

and 1. Each time the function is evaluated, a new random value is generated.
Note that the random function appears with a pair of parentheses after it, but it
cannot have anything between the parentheses.

Output-control Functions

The output-control functions set the output of the GLX’s audio channels and con-
nected Digital Adapters. The output-control functions work only when data col-
lection is in process. Each function must be used as part of a sensor-based
calculation (the calculation must include data from a sensor or time). Any prop-
erty of the audio output that is not specified in the Calculator will be determined
by the setting in the Output screen (see page 39). In the Functions menu, the
names of these functions are abbreviated to outstate, outswitch, outfreq, and out-
volume
.

outputstate(GLXPort, AdapterChannel, state)

Use the outputstate func-

tion to switch on or off a Digital Relay connected through a Digital Adapter.

17

The first argument of the function, GLXPort, can equal 1, 2, 3, or 4; it identifies
the port that the Digital Adapter is connected to. The second argument,
AdapterChannel, can equal 1 or 2 and identifies which channel of the adapter the
Digital Relay is connected to. The third argument, state, can equal any number
and determines whether the relay is OFF or ON.

If state

= 0, then the relay is OFF.

If state

≠ 0, then the relay is ON.

outputswitch(Channel, state)

Use the outputswitch function to turn on or off

the left or right audio output channel.

18

The first argument, Channel, can equal 1

(for left) or 2 (for right) and identifies which audio channel is to be controlled.

The second argument, state, can equal any number and determines whether the
audio output is OFF or ON.

If state

= 0, then the audio output is OFF.

If state

≠ 0, then the digital output is ON.

17

The Digital Relay is PASCO part

CI-6462. The Digital Adapter is PASCO
part PS-2159.

See “Relay Control” on page 67 for
instructions on connecting and configur-
ing the adapter.

18

Whether the output is played through

the output port (to a pair of headphones
or amplified speakers) or through the
GLX’s built-in speaker depends on the
Output setting in the Output screen (see
page 40).

Advertising