Asked — Edited

Counter

Has anyone made a script for a timer? My wife asked if I could make one using ARC . If someone has made one please let me know, if not, I will start on it tomorrow. Basically say "Set timer" the robot than asks how many minutes and will start the countdown based on the the response.


ARC Pro

Upgrade to ARC Pro

ARC Pro is your passport to a world of endless possibilities in robot programming, waiting for you to explore.

United Kingdom
#2  

There are at least 2 ways to tackle this,

  1. Setting the timer for a specific time - "robot set timer for 10:30am" or
  2. Setting the timer for a specific amount of time - "robot set reminder for 45 minutes"

The first is done using WaitForTime The second is done using the $hour and $minute variables

I don't have time right now but I'll pop up some examples when I do have time.

United Kingdom
#3  

Just thinking about it and it's going to be a lot of code to pick up times accurately. Basically a waitforspeech needs a phrase list, so;

$reminderhour=WaitForSpeech(10,"one","two","three"..."eleven","twelve")

Then the same for minutes but zero to 59.

Then convert the text to number, using IFs 72 IFs to be precise... That's a lot of ifs. This may be able to be removed if spoken variables with the phrases 1,2,3,4,5,6,7,8,9,10,11 & 12 are stored as numbers not strings... this I am not sure of as I have never used it.

If($reminderhour = "one")
  $reminderhour = 1
ElseIf($reminderhour = "two")
  $reminderhour = 2
...
ElseIf($reminderhour = "twelve")
  $reminderhour = 12
EndIf

Then the

WaitUntilTime($reminderhour,$reminderminute)
Say("Alert, Alert, This is your reminder")

or if you want to set it for x hours and x minutes time the phrase list could be huge, depending on how many hours time you want to be able to go up to. The same WaitForSpeech code up to the number of hours needed, then the IFs as above.

Then work out the time for the countdown, two ways to do this, either reduce the $reminderminute by 1 every minute or calculate the time it'll be and wait until then. Since waituntiltime is above I'll show the other way.


$reminder = $reminderhour*60
$reminder = $reminder + $reminderminute
:loop
WaitForChange($minute)
$reminder = $reminder - 1
If($reminder = 0)
  SayWait("Alert, Alert, This is your reminder")
Else
  Goto(loop)
EndIf

#4  

awesome! thanks for posting that quick, I will load this up and let you guys know how it went, now my wife will have a kitchen robot helper. :)