Shop OBEX P1 Docs P2 Docs Learn Events
repeat problem — Parallax Forums

repeat problem

pusinkpusink Posts: 68
edited 2009-11-18 21:30 in Propeller 1
i use window vista....i·write program like this....

Pub LedOn
dira[noparse][[/noparse]0] ~~
outa[noparse][[/noparse]0] := 1
waitcnt(clkfreq + cnt)········ '1s delay
outa[noparse][[/noparse]0] := 0

led on in 1s and off...i have no problem with that code...

the problem is....

Pub LedOn
dira[noparse][[/noparse]0] ~~
repeat· '<
outa[noparse][[/noparse]0] := 1
waitcnt(clkfreq + cnt)········ '1s delay
outa[noparse][[/noparse]0] := 0
waitcnt(clkfreq + cnt)········ '1s delay

led not turn on when i put repeat.....
it is because propeller tool......?



Post Edited (KEELOQ) : 11/18/2009 2:09:41 PM GMT

Comments

  • ErNaErNa Posts: 1,830
    edited 2009-11-18 14:09
    use [noparse][[/noparse] code ] [noparse][[/noparse]/code ]


    Pub LedOn
    dira[noparse][[/noparse]0] ~~
    repeat  '<-------
      outa[noparse][[/noparse]0] := 1
      waitcnt(clkfreq + cnt)         '1s delay
      outa[noparse][[/noparse]0] := 0
      waitcnt(clkfreq + cnt)         '1s delay
    
    


    indentation may help

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    cmapspublic3.ihmc.us:80/servlet/SBReadResourceServlet?rid=1181572927203_421963583_5511&partName=htmltext
    Hello Rest Of The World
    Hello Debris
    Install a propeller and blow them away wink.gif
  • StefanL38StefanL38 Posts: 2,292
    edited 2009-11-18 17:29
    Indention is critical

    if you write

    repeat  '<-------
    outa[noparse][[/noparse]0] := 1
    waitcnt(clkfreq + cnt)         '1s delay
    outa[noparse][[/noparse]0] := 0
    waitcnt(clkfreq + cnt)         '1s delay 
    
    



    where the commands below the repeat are NOT indented this means there is a empty repeat-loop

    if you write

    repeat  '<-------
      outa[noparse][[/noparse]0] := 1
      waitcnt(clkfreq + cnt)         '1s delay
      outa[noparse][[/noparse]0] := 0
      waitcnt(clkfreq + cnt)         '1s delay 
    
    



    where the commands below the repeat ARE indented all the lines that are indented belong to the repeat

    repeat  '<-------
      outa[noparse][[/noparse]0] := 1                   'belongs to repeat
      waitcnt(clkfreq + cnt)         'belongs to repeat
    outa[noparse][[/noparse]0] := 0                   'belongs NOT to repeat
    waitcnt(clkfreq + cnt)         'belongs NOT to repeat
    
    



    best regards

    Stefan
  • pusinkpusink Posts: 68
    edited 2009-11-18 21:30
    thank you very much......
Sign In or Register to comment.