Welcome to Synthiam!

Program robots using technologies created from industry experts. EZ-Builder is our free-to-use robot programming software that makes features like vision recognition, navigation and artificial intelligence easy.
Get Started

Asked — Edited
Resolved Resolved by Rich!

How To Run A Script At Set Intervals?

It seems like an easy thing to do but I cant quite seem to figure how to trigger a script at set intervals. For example if I want to run a re-calibration script every 30 minutes to home an encoder. I did this and put it in the personality generator but sometimes it will run the homing script a lot more then necessary.

Any advice is welcomed.

#10  
BTW, I ran into the sleep() issue over a year ago. As I recall I couldn't get a script to sleep more then one minute. I brought it up on this forum then. If this is still the case then perhaps your sleep loop scripts are the way to go.
#11  
@Rich,
Just a note to say that your script to run a script at set timed interval works perfectly. You said it was a ruff and crude script but I don't see how you could have improved it. It runs every half hour exactly based on when I started EZ Builder.

Now if I wanted to adjust the time frame what would I need to change?
United Kingdom
#12  
@Dave, which script, I posted a few.

The last one is just adjusting the first variable $sleeptime from 30 to however many minutes you want. The other scripts, find any reference to 30 and change it to however many minutes you want (up to an hour) I think, I'd have to check properly but should be leaving for work really!
#13  
It's the first one where it checks the system clock.

Dont worrie. I'll get it figured out based on what you just stated. Get to work and have a good day. It's time for me to get to bed. :D
United Kingdom
#14  
First one;

Code:


:loop
$waithour = $hour
$waitminute = $minute

# Change the 29 to however many minutes minus 1 minute
IF($waitminute > 29)

# Change the 30 to however many minutes
$waitminute = $waitminute - 30
$waithour++
IF($waithour = 24)
$waithour = 0
EndIf
Else
# Change the 30 to however many minutes
$waitminute = $waitminute + 30
EndIf

WaitUntilTime($waithour, $waitminute)

# Your commands here

Goto(loop)
#15  
Rich, your help is very appreciated. You make the learning curve a lot less bumpy. :)