28029 Parallax Inc, 28029 Datasheet - Page 117

KIT PARTS SMART SENSORS W/TEXT

28029

Manufacturer Part Number
28029
Description
KIT PARTS SMART SENSORS W/TEXT
Manufacturer
Parallax Inc
Datasheet

Specifications of 28029

Accessory Type
Parts Kit
Product
Microcontroller Accessories
Lead Free Status / RoHS Status
Contains lead / RoHS non-compliant
For Use With/related Products
BASIC Stamp® or Javelin Modules
Lead Free Status / RoHS Status
Lead free / RoHS Compliant, Contains lead / RoHS non-compliant
Other names
28029PAR
Your Turn - Testing the Arccosine Subroutine
Here are some modifications you can make to TestArcsine.bs2 to make it test the
Arccosine
Displaying Accelerometer Tilt Angle
Figure 3-31 shows the Board of Education with a Memsic Accelerometer. The figure
also shows a close-up of the accelerometer module and its x
axes. These sensing axes detect components of the earth's acceleration due to gravity.
As you tilt a given axis toward vertical, larger components of the earth's 1 g act on the
axis.
LOOP
angle = angle */ 361
IF sign = Negative THEN angle = 180 - angle' Adjust if sign is negative.
RETURN
IF (COS angle <= side) THEN EXIT
angle = angle + 1
Save TestArcsine.bs2 as TestArccosine.bs2.
Update the comments in the title section. Cosine values will be swept from 127
to −127.
Change
Change
Modify the Main Routine so that it looks like this
DO UNTIL cosine = -127
LOOP
END
Run the modified test program. As
should sweep from 0 to 180°.
cosine = cosine - 1
side = cosine
DEBUG "cosine = ", SDEC cosine, "
GOSUB Arccosine
DEBUG SDEC ? angle
subroutine instead.
sine VAR Word
sine = −128
to
to
cosine = 128
cosine VAR Word
Chapter 3: Tilt with the Memsic Accelerometer · Page 105
cosine
in the Initialization section
"
' Done when COS angle <= side
' Keep increasing angle
' Convert brads to degrees
sweeps from 127 to -127, the angle
in the Variables section.
m
and y
m
acceleration sensing

Related parts for 28029