PDA

View Full Version : incrementing question..



Rontopia
01-09-2008, 03:54 AM
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:)

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

Rontopia
01-09-2008, 03:55 AM
hmm this thing does not seem to maintain spacing that is there when I wrote it..

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



IC layout designer
Austin Texas

Rontopia
01-09-2008, 04:03 AM
oh wait.. all i have to say is "i++"?

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



IC layout designer
Austin Texas

Javalin
01-09-2008, 04:05 AM
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 Mueller
01-09-2008, 04:35 AM
> 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 (http://www.yadro.de)

Javalin
01-09-2008, 04:37 AM
Thanks Nick - was thinking in the wrong languge (VB) - have updated!

Javalin