Section Use drawing image and sound files for effects Drawing

StampPlot allows drawing of shapes and placing text on the plot. In general, the structure is: The drawing type + instruction, coordinates, parameters. For example:

@TEXT 35a, 102a, 2, (BLUE), StampPlot Rules! Drawing type

StampPlot supports 4 different types of drawing depending on what you want to produce.

Starts with @: Drawing is 'constant' and will survive a reset. Good if you want something on the plot permanently even if you reset.

Starts with Drawing is 'temporary' and will be erased with resets, or anytime the plot shifts or is refreshed.

Starts with A: Drawing is treated as a data points and will be plotted just as data is when the plot is shifted. As data, it is erased when the plot is reset. Plotting must be enabled. Starts with !: Drawing is the same as using A but the drawing is restricted to the data plotting area. Plotting must be enabled.

V Test the following in the Immediate/DEBUG window's CLI:

!POBJ Clear !NEWP !PLOT ON

@TEXT 35a, 102a, 2, (BLUE), StampPlot Rules! ~FREC 10,25,30,150,(RED) *FCIR 96,125,5,(GREEN) !RECT 48,50,72,175,(BLACK)

V Now shift around the plot and compare what occurs as the plot is moved.

Why didn't the text move? The objects change position because their coordinates are based on the plot coordinates. Using absolute coordinates, you can plot using points independent of the plot scales, where lower left is 0a, 0a, and upper right is 100a, 100a.

Of course, these instructions can come from the BASIC Stamp module using debug.

V Try this using this in a PBASIC program:

'Plot and mark values of points

PAUSE 1000

'Plot and mark values of points

PAUSE 1000

DEBUG

CR,"!POBJ Clear",CR

DEBUG

"!NEWP",CR

DEBUG

"!PLOT ON",CR

DEBUG

"@TEXT 35a, 102a, 2, (BLUE), StampPlot Rules!"

, CR

x VAR Byte x = 100

DO

RANDOM x

' Plot value

DEBUG DEC x,CR

' Mark data with value

using text

DEBUG "!TEXT (PTIME),",

, DEC x,",1,(black),O "

, DEC x,CR

PAUSE 2 000

LOOP

(PTIME) in the text instruction substitutes the current plot time in seconds for the X coordinate. As always, monitor in the BASIC Stamp Editor's Debug Terminal ensure the format is correct.

102.00 126.00 150.00 171.00 138.00 222.00

Seconds

102.00 126.00 150.00 171.00 138.00 222.00

Seconds

Solar Power

Solar Power

Start Saving On Your Electricity Bills Using The Power of the Sun And Other Natural Resources!

Get My Free Ebook


Post a comment