28029 Parallax Inc, 28029 Datasheet - Page 260

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
Page 248 · Smart Sensors and Applications
a.
Counting Wheel Revolutions with Hysteresis
One problem with counting wheel revolutions is making sure that the program doesn't
advance the count if the wheel hasn't turned full circle. The most common mistake that is
made when measuring wheel revolutions is setting a single threshold. What if the rider is
waiting at a stop light, and is moving his/her bike back and forth by an inch or two? If
there is a single threshold, the wheel revolution counter will keep increasing every time
the rider rocks back and forth.
The next example program demonstrates a way of solving this problem with hysteresis.
Hysteresis is the process of setting two different values that have to be crossed before a
change in state occurs. In our case, the change of state is an increase in the wheel
revolution count. With hysteresis, the measurement must fall below a low value, and
then the program waits until it has risen up above a higher value before acknowledging
an upward change. Then, the measurement will have to go below the low threshold again
before a change from high to low is acknowledged.
acknowledges that the measurement went below the low value and then above the high
value, it increases the wheel revolution count by 1.
Here is some code that performs hysteresis. In the first of the two nested
blocks, the program waits until the y axis rises above 2650. Then, the second of the two
nested
then will it add 1 to the
piezospeaker beep, and then repeats the outer
back to waiting for the y axis measurement, which was below 2350 to rise back above
DO
...
LOOP
commands waits until the y axis measurement drops below 2350. Only
counter
b.
variable.
DO
...
After that, the program makes the
LOOP
. At this point, the program is
Figure 6-18
HomeWork Board with
Accelerometer Mounted
on Bicycle Wheel
Each time the program
DO
...
LOOP

Related parts for 28029