Shop OBEX P1 Docs P2 Docs Learn Events
Trying to understand servo control — Parallax Forums

Trying to understand servo control

LisaQLisaQ Posts: 33
edited 2010-03-06 17:43 in Learn with BlocklyProp
I want to be sure I understand this correctly:

Does PULSOUT 14, 1000 mean "send a high out on pin14 for 2mS"?

and if it does, would HIGH 14
·························· ··PAUSE 2
do the same thing?

LisaQ

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2010-03-06 15:27
    Actually, PULSOUT 14,1000 means "toggle pin 14 for 2ms" if you're using a BS2. On other Stamp models, the time may be different.

    If the initial pin state is low, that means "send a high out on pin 14 for 2ms".

    Yes, you could do "HIGH 14 : PAUSE 2"

    Read the description of the statement in the "BASIC Stamp Syntax and Reference Manual". It's pretty explicit.
  • LisaQLisaQ Posts: 33
    edited 2010-03-06 15:45
    Mike,

    I guess I'm confused about the definition of pulse- I thought it was a transition of hi to low or low to high. If I understand what you're saying there are actually many pulses (toggle Pin 14 for·2ms)·within that 2 mS.

    Now I have another question, I'm looking at the example in Syntax manual on p349.

    Pulsout 0, 2500··· 'Flash LED for 25mS

    Wouldn't 2500 * 2uS= 5mS?

    LisaQ
  • Mike GreenMike Green Posts: 23,101
    edited 2010-03-06 17:16
    You're confused ... Keep things simple ...

    Read the documentation ... Toggle means to invert ... If the signal is high, make it low. If the signal is low, make it high.

    There's one pulse produced by PULSOUT, but its polarity depends on the initial state of the I/O pin.

    The example in the Reference Manual is for the BS1 where the time units for PULSOUT are 10us, not 2us.
  • LisaQLisaQ Posts: 33
    edited 2010-03-06 17:43
    Mike, Thanks for clearing that up.
Sign In or Register to comment.