waveforms detections

bluejaybluejay Posts: 77
edited 2020-03-20 - 20:15:20 in BASIC Stamp
Does anybody know how to display waveforms on the screen terminal such as square waves from a 555 timer instead of one's and zeros?

The simple program displays digits of one's and zeros. Thanks in advance.
' {$STAMP BS2}
' {$PBASIC 2.5}
'input ex1
'Syntax: COUNT Pin, Duration, Variable
'Syntax: PULSIN Pin, State, Variable

box PIN 4
result VAR Nib

DO
    COUNT CR, box,result
    'DEBUG ? box
     DEBUG BIN box
     'PAUSE 100
     'PULSIN box,1,result
     'DEBUG HOME,"input=  ",DEC box
      LOOP

Comments

  • tomcrawfordtomcrawford Posts: 1,079
    edited 2020-03-20 - 21:35:55
    With PBasic DEBUG, you are limited to a text-based display. In other words, only letters, numbers, and special characters. "|" and "_" turn out to be straight lines; p'raps you can string them together.
    __
             __|   |__
    
  • Tracy AllenTracy Allen Posts: 6,435
    edited 2020-03-23 - 17:35:26
    You have,
    COUNT CR, box,result
    but the proper syntax is
    COUNT pin, duration, variable
    If box is your pin number, and you want to count for 1 second, then it would be
    COUNT box, 1000, result.

    If the rate of change is relatively slow, the display of a multi-level result can be made to scroll down the screen.
    DO
      result = result+1 // 10     ' result cycles from 0 to 9 and back to zero, 
                                               ' or result could be from your COUNT or an ADC
      DEBUG CR, REP "*"\result   ' prints a line of that many stars
      PAUSE 32                           ' slow it down a bit
    LOOP
    
    *
    **
    ***
    ****
    ******
    *******
    ********
    *********
    **********
    ***********
    *
    **
    ***
    ****
    ******
    *******
    ********
    *********
    **********
    ***********
    *
    **
    ***
    ****
    ...
    
Sign In or Register to comment.