Shop OBEX P1 Docs P2 Docs Learn Events
incrementing question.. — Parallax Forums

incrementing question..

RontopiaRontopia Posts: 139
edited 2008-01-08 21:37 in Propeller 1
hi all its been a while.. Ive been super busy. I could explain but it would take longer then the question i have.. so.. I wont[noparse]:)[/noparse]

so I have this problem of not being able to find how to itterate a var. at least not in spin. Im use to something like

i = i ++

.. what im trying to do is find out how many pings I can do in 1 second using the ping.spin object. so im thinking something like

OBJ ''define the objects used.
rPing : "Ping"
Debug : "FullDuplexSerialPlus"

VAR
long i '' variable for incrementing

PUB Main ''define the repeat loop.
repeat until cnt := cnt + 12_000_000 ''using default clock speed
rPing.Ticks(16) '' using the ping object and passing pin 16 to it.
for i = i++ '' this is where I would increment i, but I dont know what operator to use..please advise



thanks

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔



IC layout designer
Austin Texas

Comments

  • RontopiaRontopia Posts: 139
    edited 2008-01-08 20:55
    hmm this thing does not seem to maintain spacing that is there when I wrote it..

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔



    IC layout designer
    Austin Texas
  • RontopiaRontopia Posts: 139
    edited 2008-01-08 21:03
    oh wait.. all i have to say is "i++"?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔



    IC layout designer
    Austin Texas
  • JavalinJavalin Posts: 892
    edited 2008-01-08 21:05
    You use:

    i += 1
    

    Which is the spin equivelent of the C/C++:

    i++
    

    or the general
    i:=i+1
    

    And to show the formatting - use the # on the toolbar of the reply/post form

    Javalin

    Edit - Ooops.· Was thinking in the wrong language..!

    Post Edited (Javalin) : 1/8/2008 9:39:03 PM GMT
  • Nick MuellerNick Mueller Posts: 815
    edited 2008-01-08 21:35
    > i=i+1

    But it is i:= i + 1

    Nick

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Never use force, just go for a bigger hammer!

    The DIY Digital-Readout for mills, lathes etc.:
    YADRO
  • JavalinJavalin Posts: 892
    edited 2008-01-08 21:37
    Thanks Nick - was thinking in the wrong languge (VB) - have updated!

    Javalin
Sign In or Register to comment.