Asked — Edited

Test This Script For Me

Good Morning,

Could the members of the community with fast computers please run this script for me and tell me the CPU load from ARC. For me, when I run this script my CPU process from ARC is 50 percent. If you have something at D20,D21,D22 just comment the PWM statements out.



:loop
REPEAT($x,0,100,10)
PWM(D20,$x)
PWM(D21,$x)
PWM(D22,$x)
print($x)
ENDREPEAT
If ($x = "100")
 REPEAT($x,100,0,10)
 PWM(D20,$x)
 PWM(D21,$x)
 PWM(D22,$x)
 ENDREPEAT
ENDIF
goto(loop)


Thank You Wayne A


ARC Pro

Upgrade to ARC Pro

Get access to the latest features and updates before they're released. You'll have everything that's needed to unleash your robot's potential!

United Kingdom
#1  

No need to test it, you need to add in a sleep to the code. Without the sleep the script will run too fast as ARC can perform over 9500 commands per second (at least that's less than the average on my PCs).

It looks like ramping of the PWM from 0 to 100, that's 100 commands, at 9500 per second you wont get any noticeable ramping.

CPU load isn't really the thing to be looking at just yet.

#2  

We need an initial value of $x... I used 0... Your script runs lightning fast on my PC. It doesn't bog down ARC... Mine indicates 27%... However, I just ran the script, I did not have an EZB4 connected at the time...

Does the script have to run that fast? Can you put some sleep commands in so you are not using up so much processor?

#3  

LOL... Rich beat me to it, again... you need a sleep command to slow things down... less demand on the processor...

#4  

Ok, where would the sleep go?

#5  

I usually put sleep commands at the bottom of loops (see below)... you can change the vale of sleep to suit your needs...


:loop
REPEAT($x,0,100,10)
PWM(D20,$x)
PWM(D21,$x)
PWM(D22,$x)
print($x)
sleep(20)
ENDREPEAT
If ($x = "100")
 REPEAT($x,100,0,10)
 PWM(D20,$x)
 PWM(D21,$x)
 PWM(D22,$x)
sleep(20)
 ENDREPEAT
ENDIF
goto(loop)