Shop OBEX P1 Docs P2 Docs Learn Events
I/O question — Parallax Forums

I/O question

GrantmcFGrantmcF Posts: 30
edited 2012-09-04 17:58 in Propeller 1
Why does this method not work without the repeat? I assume it runs once, but to fast to see. Why does it not latch the output until something else changes it?

Pub LED_On
repeat
dira[16] :=1
outa[16] :=1

Comments

  • kuronekokuroneko Posts: 3,623
    edited 2012-09-03 16:46
    GrantmcF wrote: »
    Why does this method not work without the repeat? I assume it runs once, but to fast to see. Why does it not latch the output until something else changes it?
    It latches the value without problems. The issue here is that the next thing being done (main method ends) is to stop the cog which in turn means kill all the outputs. What you want is some method to keep the cog alive (after the outa assignment), e.g. waitpne(0, 0, 0) or more commonly a single repeat etc.

    If this is not the main method then something else gets in the way in which case you should post the remainder of the code.
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2012-09-03 19:19
    GrantmcF,

    When you post code -- especially Spin code, which relies on indents as part of its syntax -- please do it as advised here:

    attachment.php?attachmentid=78421&d=1297987572

    Kuroneko was able to infer what you meant, but the code you posted, without the indents, would simply hang without doing anything.

    -Phil
  • GrantmcFGrantmcF Posts: 30
    edited 2012-09-04 17:24
    Thanks Kuroneko. The method was straight out of the customizing the propeller book. I need to position some relays for long term and was having some issues, so I went back to the basics. The repeat is what was throwing me off. I was trying to work without it.

    Phil
    I know about the indents, but apparently there is an auto correct to the post when you type it in as opposed to cut and paste
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2012-09-04 17:58
    I know about the indents, but apparently there is an auto correct to the post when you type it in as opposed to cut and paste
    That's why you need to use the [noparse][code][/noparse] tags that I referenced. Please click on the link I provided for a full explanation.

    -Phil
Sign In or Register to comment.