Welcome to Synthiam!

The easiest way to program the most powerful robots. Use technologies by leading industry experts. ARC is a free-to-use robot programming software that makes servo automation, computer vision, autonomous navigation, and artificial intelligence easy.

Get Started
Asked — Edited
Resolved Resolved by Rich!

Counter Script

Could any of you fine folks please post an example script of a counter. The "counted number" would be contained in a $string value?

Thanks
WayneA


ARC Pro

Upgrade to ARC Pro

Become a Synthiam ARC Pro subscriber to unleash the power of easy and powerful robot programming

AI Support Bot
Related Content
Synthiam
Based on your post activity, we found some content that may be interesting to you. Explore these other tutorials and community conversations.
United Kingdom
#1  
A little more info is needed really as we have no idea what increases the count. Also, technically a string is alphanumeric not numeric so couldn't be a counter.

But make the script from the following elements...

First define and set the variable

Code:

$counter = 0


Have your script do whatever needs doing and when the counter needs increasing by one use

Code:

$counter++


So, for instance, if you wanted something to loop 100 times the code would be

Code:


$counter = 0

RepeatWhile ($counter < 100)
Print($counter)
$counter++
Sleep(100)
EndRepeatWhile


But if you wanted the counter to count how many times the camera started tracking it would be

Code:


$counter = 0

:loop
IF($CameraIsTracking = 1)
$counter++
EndIf
WaitForChange($CameraIsTracking)
Goto(loop)
#2  
@Rich Thank You for the quick response. What you have provided gave me the answer I was looking for.