BASIC stamp manual v2.2

BASIC Stamp Architecture – //, ATN
Page 114 BASIC Stamp Syntax and Reference Manual 2.2 www.parallax.com
returns the remainder, 4 in this example. Naturally, numbers that divide
evenly, such as 1000/5, produce a remainder of 0.
Example:
SYMBOL value1 = W0
SYMBOL value2 = W1
value1 = 1000
value2 = 6
value1 = value1 // value2 ' Get remainder of value1 / value2
DEBUG value1 ' Show the result (4)
-- or --
value1 VAR Word
value2 VAR Word
value1 = 1000
value2 = 6
value1 = value1 // value2 ' Get remainder of value1 / value2
DEBUG ? value1 ' Show the result (4)
The Arctangent operator (ATN) returns the angle to the vector specified
by X and Y coordinate values. The syntax of ATN is:
xCoord ATN yCoord
where xCoord and yCoord are the coordinates of the target vector point.
In the BASIC Stamp, the angle is returned in binary radians (0 to 255)
instead of degrees (0 to 359). See the explanation of the SIN operator for
more information about binary radians. Coordinate input values are
limited to -127 to 127 (signed bytes) as shown in the diagram of the
PBASIC Unit Circle (Figure 4.2).
brads VAR Word ' angle in brads
degr VAR Word ' angle in degrees
brads = 4 ATN 4 ' get angle
degr = brads */ 360 ' convert to degrees
DEBUG SDEC ? brads ' display brads (32)
DEBUG SDEC ? degr ' display degrees (45)
All
2
ARCTANGENT: ATN