130-28029 Parallax Inc, 130-28029 Datasheet - Page 204

KIT PARTS SMART SENSORS

130-28029

Manufacturer Part Number
130-28029
Description
KIT PARTS SMART SENSORS
Manufacturer
Parallax Inc
Datasheet

Specifications of 130-28029

Accessory Type
Education Kit
Product
Microcontroller Accessories
Lead Free Status / RoHS Status
Contains lead / RoHS non-compliant
For Use With/related Products
BASIC Stamp®
Lead Free Status / RoHS Status
Lead free / RoHS Compliant, Contains lead / RoHS non-compliant
Page 192 · Smart Sensors and Applications
' -----[ Variables ]----------------------------------------------------------
x
y
index
char
' -----[ Initialization ]-----------------------------------------------------
FOR index = 0 TO 242
NEXT
' -----[ Main Routine ]-------------------------------------------------------
DO
LOOP
READ index, char
DEBUG char
' Replace asterisk with background character.
index = (22 * y) + x + 1
READ index, char
DEBUG CRSRXY, x, y, char
PAUSE 50
' Measure tilt.
PULSIN 6, 1, x
PULSIN 7, 1, y
' Calculate cursor position.
x = (x MIN 1875 MAX 3125) - 1875 ** 1101
y = (y MIN 1875 MAX 3125) - 1875 ** 576
y = 10 - y
' Display asterisk at new cursor position.
DEBUG CRSRXY, x, y, "*"
PAUSE 50
Hold your board as shown in the top of Figure 5-12.
Practice controlling the asterisk by tilting the board.
Aside from holding your board horizontally and tilting it, try holding it vertically
and rotating it in a circle. The asterisk should travel in a circular arc around the
graph as you do so.
VAR
VAR
VAR
VAR
Word
Word
Word
Byte
' Store current position
' READ index/character storage
' Read & display background
' Begin main routine
' Coordinates -> EEPROM address
' Get background character
' Display background character
' Pause for blink effect
' Get Ax and Ay
' Calculate x position
' Calculate y position
' Display asterisk
' Pause again for blink effect
' Repeat main routine

Related parts for 130-28029