28029 Parallax Inc, 28029 Datasheet - Page 97

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
ACTIVITY #5: MEASURING 360° VERTICAL ROTATION
The MX2125 has a built-in feature that allows you to use both the x and y axis tilt
measurements to calculate the accelerometer's angle of rotation in the vertical plane, as
shown in Figure 3-15. There are lots of applications where vertical tilt is useful,
including virtual steering wheels for video games and counting bicycle wheel revolutions.
This activity demonstrates how to calculate tilt on the vertical plane with the PBASIC
ATN
Calculating Arctangent with PBASIC
The tangent of an angle theta (θ) in a right triangle is the ratio of the opposite side of a
right triangle (y) divided by the adjacent side (x). If you know the values of x and y, you
can use the inverse tangent or arctangent to figure out the angle θ. The most common
notations for arctangent are tan
operator.
Open SimpleTilt.bs2 from Activity #1 and save it as CentigravityTilt.bs2
Follow the steps for scaling from Activity #3 and determine the
scale constants.
Add lines of code to the program that scale the x and y values down to g/100.
Modify the display so that it shows in the Debug Terminal.
Test according to Figure 3-14 and troubleshoot if necessary.
−1
and arctan.
Chapter 3: Tilt with the Memsic Accelerometer · Page 85
Figure 3-15
Tilt on the Vertical Plane
**
operation

Related parts for 28029