28029 Parallax Inc, 28029 Datasheet - Page 128

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 116 · Smart Sensors and Applications
' Smart Sensors and Applications - Ch3Proj1.bs2
' Based on VertWheelRotation.bs2, this device counts the number
' of times the board has been rotated on the vertical plane.
'{$STAMP BS2}
'{$PBASIC 2.5}
angle
angleOld
x
y
turnCount
PAUSE 250
SEROUT 14, 84, [22, 12]
PAUSE 5
SEROUT 14, 84, [128, DEC5 turnCount]
DO
LOOP
PULSIN 6, 1, x
PULSIN 7, 1, y
x = (x MIN 1875 MAX 3125) - 1875 ** 13369 - 127
y = (y MIN 1875 MAX 3125) - 1875 ** 13369 - 127
angle = x ATN y
angle = angle */ 361
IF (angle >= 90 AND angle < 180) AND (angleOld < 90 OR angleOld >= 270) THEN
ENDIF
IF angle >= 270 AND (angleOld >= 90 AND angleOld < 180) THEN
ENDIF
SEROUT 14, 84, [128, DEC5 (turnCount / 2)]
P1. Example solution:
turnCount = turnCount + 1
angleOld = angle
turnCount = turnCount + 1
angleOld = angle
VAR
VAR
VAR
VAR
VAR
Word
Word
Word
Word
Word
' Initialize LCD

Related parts for 28029