Shop OBEX P1 Docs P2 Docs Learn Events
time between pulses — Parallax Forums

time between pulses

ArchiverArchiver Posts: 46,084
edited 2004-07-13 18:34 in General Discussion
In a message dated 7/12/2004 7:41:25 PM Eastern Daylight Time,
msfwebdude@h... writes:


> With this information I can create a signature of the button on the
> remote and use that button to activate a servo.
>

If you write pulsein 1, length, you measure the duration of a high pulse.

If you write pulsin 0, length it gives you the duration of the low pulse.

Take a look at this command in the online Help section of the Basic Editor.

Sid


[noparse][[/noparse]Non-text portions of this message have been removed]

Comments

  • ArchiverArchiver Posts: 46,084
    edited 2004-07-13 00:00
    I have an IR module that outputs a square qave that corresponds to a
    button on the remmote.

    I need to get the length of the pulses and am kinda doing that with
    the PULSIN command

    the square wave produced by the filtering and other circuits in the
    ir module sorta looks like this _
    __---_--_

    the lengh of the pulse and the length of of time between the pulses
    need to be calculated

    So far I am able to get the length of the high pulses (see my source
    code below)

    ### I still need to find the time between the high pulses. ###

    With this information I can create a signature of the button on the
    remote and use that button to activate a servo.

    Thanks for any help.

    Mike Firoved





    '{$STAMP BS2}
    '{$PBASIC 2.5}

    '****************************
    '***** PIN ASSIGNMENTS ******
    '****************************
    IrModuleInput PIN 0
    ServoOutput PIN 1



    '****************************
    '*** VARIABLE ASSIGNMENTS ***
    '****************************
    xa VAR Word
    xb VAR Word
    xc VAR Word
    xd VAR Word
    xe VAR Word
    xf VAR Word

    start:

    PAUSE 1

    PULSIN IrModuleInput, 1, xa
    IF xa=0 THEN GOTO start
    PULSIN IrModuleInput, 1, xb
    PULSIN IrModuleInput, 1, xc
    PULSIN IrModuleInput, 1, xd
    PULSIN IrModuleInput, 1, xe
    PULSIN IrModuleInput, 1, xf

    DEBUG DEC xa
    DEBUG DEC xb
    DEBUG DEC xc
    DEBUG DEC xd
    DEBUG DEC xe
    DEBUG DEC xf

    GOTO start
  • ArchiverArchiver Posts: 46,084
    edited 2004-07-13 18:34
    Note you can use 'RCTime' to measure how long
    things are in a certain state. You lose the
    amount of time it takes the BS2 to interpret
    the RCTime command, of course.

    --- In basicstamps@yahoogroups.com, Newzed@a... wrote:
    > In a message dated 7/12/2004 7:41:25 PM Eastern Daylight Time,
    > msfwebdude@h... writes:
    >
    >
    > > With this information I can create a signature of the button on
    the
    > > remote and use that button to activate a servo.
    > >
    >
    > If you write pulsein 1, length, you measure the duration of a high
    pulse.
    >
    > If you write pulsin 0, length it gives you the duration of the low
    pulse.
    >
    > Take a look at this command in the online Help section of the Basic
    Editor.
    >
    > Sid
    >
    >
    > [noparse][[/noparse]Non-text portions of this message have been removed]
Sign In or Register to comment.