Shop OBEX P1 Docs P2 Docs Learn Events
stamp plot question — Parallax Forums

stamp plot question

cplattcplatt Posts: 55
edited 2011-07-27 17:16 in Accessories
Hello Everyone. Anyone out there with some Stamp Plot experience? I would like to overlay 3 plots of one hour temperature taken at different times of the day without the added hassle of exporting the data to Excel. Kind of like how 3 channels' values are displayed at the same time and the graph shows three different colored plots overlayed. Hope this makes sense. (have donated)

Comments

  • Martin HebelMartin Hebel Posts: 1,239
    edited 2011-07-25 07:10
    Hi, are you going to plot these in real time? And, yes, it should be possible by using constant-drawing modes - that is, drawings that don't erase on a reset.

    The format for a normal line (using constant drawing) is:
    @LINE X1, Y1, X2, Y2, Color
    Using T0 (current time) and L0 (last time accessed), these can be used for the X-Axis, such that:
    @LINE (T0),Last_Value,(L0),Current_Value,(BLACK)
    would draw a line from the last value sampled to the current value sampled.
    DEBUG "@LINE (T0),", DEC Last_Value, ",(L0),", DEC Current_Value,",(RED)",CR

    Once you have done the plot for the 1st hour, issue a reset ( DEBUG "!RSET",CR) and repeat using another color.

    You will also need to set the last_value = current_value for the very first data point.

    On a plane now, but if you have problems I can probably write a sample program doing this in the next couple days if need be.

    Oh, to clear your constant drawings to start over again, issue a Clear Constant instruction, !CLRC (DEBUG "!CLRC",CR).

    I only watch the Wireless and Stamps In Class forums these days as these are so many postings and forums, but you may also directly Email me at support@selmaware.com - especially if you bought a license (donation?)!

    Hope this helps,
    Martin Hebel (StampPlot Developer)
  • Martin HebelMartin Hebel Posts: 1,239
    edited 2011-07-25 08:33
    Oppps, got my T0 and L0 backwards in the example...
    @LINE (L0),Last_Value,(T0),Current_Value,(BLACK)
  • cplattcplatt Posts: 55
    edited 2011-07-26 10:20
    Martin, that is exactly what I want, but my plot is not a straight line. (see the attachment) How about running the plot on one channel and color, then resetting the x origin to zero (somehow) and running the second plot on a second channel and color?
    640 x 400 - 43K
  • Martin HebelMartin Hebel Posts: 1,239
    edited 2011-07-27 04:36
    No, it won't be a straight line. Each sample will have different values for current value, so do an hours worth of data with the code I recommended. If it was possibly to simply use a channel, reset, use another channel I would have recommended it, but it's not.

    Good luck !

    Martin
  • cplattcplatt Posts: 55
    edited 2011-07-27 08:27
    Thank you so much Martin...Stamp Plot really does the trick!
  • cplattcplatt Posts: 55
    edited 2011-07-27 09:27
    Martin: I do not really understand "current time TO" vs. "last time accessed LO" as it applies to my simple code"
    Main:
      PAUSE 250
      DEBUG CR, "!RSET",CR
      PAUSE 250
        FOR i=1 TO 400
           PULSIN Xin, HiPulse, sensor          'input from memsic 2125 accelerometer
           DEBUG DEC (sensor),CR
            i=i+1
            PAUSE 100
        NEXT
       DEBUG "@LINE (LO),",DEC 400,",(TO),",DEC 1,",(RED)",CR
    
    END
    
  • Martin HebelMartin Hebel Posts: 1,239
    edited 2011-07-27 17:16
    Actually, I've been thinking about this, and it may be possible plotting normally:
    - run the first plot
    - copy the plot image to drawing page 1
    - reset
    - plot on page 1 for 2nd plot
    - copy the image to page 0
    - reset
    - plot on page 0 for third plot
    May have to try this one...

    Martin
Sign In or Register to comment.