28029 Parallax Inc, 28029 Datasheet - Page 99

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
Converting from Brads to Degrees with
In the previous activity, we used the
to a smaller range. Converting from brads to degrees involves scaling a smaller scale of
0 to 255 to a larger scale of 0 to 359. The PBASIC
When you use a command like
ScaleConstant
by. For example, let's say you want to multiply
the result is 640. Now, if
be 25. If we want
The rules of integer math for scaling from one scale to another still apply, even though
we are converting from a smaller scale to a larger one. The only thing that will change is
the scale constant, which is a numerator of 256 for
The input scale is 0 to 255, which has 256 elements, and the output is 0 to 359, which has
360 elements. The result after substituting these values into the
equation is 361.
value = 640 */value
ScaleCons
*
*
*
*/
Remember
The
The
/
/
/
ScaleCons
ScaleCons
ScaleCons
ScaleCons
**
*/
operator multiplies by a number of 65536ths.
operator multiplies by a number of 256ths.
term is the number of 256ths you want to multiply the
value
tan
tan
t
tan
tan
tan
to equal 2.5 times
= .
value
2
t
t
t
t
=
5
=
=
=
361
×
Int
Int
Int
256
starts as 10, the result of
[
361
256
256
**
'multiply by 2.5
=
640
value
.
operator to scale values down from a larger range
412
input
256
Chapter 3: Tilt with the Memsic Accelerometer · Page 87
output
360
value
*/
]
scale
1
=
value
:
scale
*/
*/
ScaleConstant
, instead of 65536 for
elements
operator is designed for this job.
by 2.5. Multiply 2.5 by 256 and
elements
value = 640 */ value
1
*/
*/
value
scale constant
**
value
.
variable
, the
will

Related parts for 28029