Reference.Constrain History

Hide minor edits - Show changes to markup

February 06, 2010, at 09:26 AM by David A. Mellis -
Changed lines 33-35 from:
to:
February 06, 2010, at 02:51 AM by Paul Badger -
Changed lines 33-34 from:
to:
January 27, 2009, at 06:58 AM by Paul Badger -
Added lines 27-28:
April 16, 2007, at 04:37 PM by Paul Badger -
Changed line 32 from:
to:
April 16, 2007, at 04:36 PM by Paul Badger -
April 16, 2007, at 05:15 AM by Paul Badger -
Changed lines 1-2 from:

constrain(x, a, b)

to:

constrain(x, a, b)

April 16, 2007, at 05:15 AM by Paul Badger -
Changed lines 1-2 from:

constrain(x, a, b)

to:

constrain(x, a, b)

April 16, 2007, at 05:14 AM by Paul Badger -
Changed lines 1-2 from:

constain(x, a, b)

to:

constrain(x, a, b)

April 15, 2007, at 03:54 AM by Paul Badger -
Changed lines 25-26 from:

// limits range of sensor from 10 to 150 @]

to:

// limits range of sensor values to between 10 and 150 @]

April 15, 2007, at 03:52 AM by Paul Badger -
Changed lines 9-14 from:

x: the number to constrain

a: the lower end of the range

b: the upper end of the range

to:

x: the number to constrain, all data types

a: the lower end of the range, all data types

b: the upper end of the range, all data types

Added lines 23-26:

Example

sensVal = constrain(sensVal, 10, 150);
// limits range of sensor from 10 to 150 
December 02, 2006, at 07:00 PM by David A. Mellis -
Changed lines 26-28 from:
to:
December 02, 2006, at 06:14 PM by David A. Mellis -
Changed lines 11-14 from:

a: the minimum value

b: the maximum value

to:

a: the lower end of the range

b: the upper end of the range

December 02, 2006, at 06:13 PM by David A. Mellis -
Added lines 1-26:

constain(x, a, b)

Description

Constrains a number to be within a range.

Parameters

x: the number to constrain

a: the minimum value

b: the maximum value

Returns

x: if x is between a and b

a: if x is less than a

b: if x is greater than b

See also

Share