122-28029 Parallax Inc, 122-28029 Datasheet - Page 310

GUIDE STUDENT SMART SENSORS

122-28029

Manufacturer Part Number
122-28029
Description
GUIDE STUDENT SMART SENSORS
Manufacturer
Parallax Inc
Datasheet

Specifications of 122-28029

Accessory Type
Manual
Product
Microcontroller Accessories
Lead Free Status / RoHS Status
Contains lead / RoHS non-compliant
For Use With/related Products
Smart Sensors
Lead Free Status / RoHS Status
Lead free / RoHS Compliant, Contains lead / RoHS non-compliant
Page 298 · Smart Sensors and Applications
' -----[ Title ]--------------------------------------------------------------
' Smart Sensors and Applications - Ch7Proj2.bs2
' Displays a character that shifts both vertically and horizontally based
' on the MX2125's tilt angle in degrees.
' HorizontalTilt.bs2 from Chapter 3, Activity #6 and TwoAxisBarTiltDisplay.bs2
' from Chapter 7, Activity #3.
' -90 to +90 degrees to a value from 1 to 31 using the ** scale constant
' equation.
' changed to a value from 0 to 16.
' in the main routine just above their use with the ** operators.
' {$STAMP BS2}
' {$PBASIC 2.5}
' -----[ I/O Pins ]-----------------------------------------------------------
LcdPin
' -----[ Constants ]----------------------------------------------------------
T9600
LcdCls
LcdCr
LcdOff
LcdOn
Line0
Line1
Define
Negative
Positive
' -----[ Variables ]----------------------------------------------------------
custChar
index
rowMap
cursor
value
line
x
y
sine
side
angle
sign
P2. Example solution – See comments in the title section for how this program was
constructed from earlier example programs and calculations explained in the
text:
Likewise, the -90 to +90 degree y-axis measurement had to be
CON
PIN
CON
CON
CON
CON
CON
CON
CON
CON
CON
VAR
VAR
VAR
VAR
VAR
VAR
VAR
VAR
VAR
VAR
VAR
VAR
84
14
12
13
21
22
128
148
248
1
0
Byte
Nib
Byte
Byte
Byte
Byte
Word
Word
Word
Word
Word
Bit
The x-axis measurement had to be changed from
The calculations are commented and shown
' sine in circle r = 127
' trig subroutine variable
' result angle - degrees
' Sign bit
This program is a combination of
' True, 8-bits, no parity, 9600
' Target device = BASIC Stamp 2
' Language
' I/O pin connected to LCD's RX
' Form feed -> clear screen
' Carriage return
' Turns display off
' Turns display on
' Line 0, character 0
' Line 1, character 0
' Address defines cust char 0
' Sign - .bit15 of Word variables
' Custom character selector
' Eeprom index variable
' 5-pixel dotted line
' Cursor placement
' Value to be graphed
' Line0 or Line1
= PBASIC 2.5

Related parts for 122-28029