Shop OBEX P1 Docs P2 Docs Learn Events
timing pulses — Parallax Forums

timing pulses

kaoru117kaoru117 Posts: 1
edited 2007-04-06 09:12 in BASIC Stamp
I'm attempting to make a telegraph that would convert the electrical impulses to a keyboard letter for use through USB. Does the Stamp 2 allow for the timing of input pulses, which is obviously important for morse code?

Comments

  • Skywalker49Skywalker49 Posts: 172
    edited 2007-04-06 09:12
    K.

    most likely you are not interested in exact time but would like the make the diffence between long (-) and short (.)

    Well you could simply do as follows:

    CNT VAR Word ' your loop counter (byte might be enough)
    INPUT 1 ' make pin 1 an input

    CNT = 0 ' init the counter

    LOOP: ' wait for input loop
    CNT = CNT + 1
    IF IN1 = 0 THEN LOOP

    SIGNAL: ' you get here whenever the input changes
    Now based on the CNT value you can decide if it was a - / .
    Clear CNT
    Do whatever you need to do
    Return to the LOOP to capture next input
Sign In or Register to comment.