Servo Recorder icon Servo Recorder Record and replay named servo movements with adjustable speed/direction (-5 to +5), multiple recordings, ControlCommand triggers and status var Try it →
New Zealand
LinkedIn Thingiverse Twitter Google+ YouTube
Asked — Edited

Stating The Time

Tidied up the time routine a bit to include AM and PM and some other stuff...

Enjoy!

#________________________________________________

Print ("+---------------------+") Print ("| Announcing the time |") Print ("+---------------------+")

say("The time is ")

IF ($hour>12) $hour_word=$hour-12 $hour_word+":" ENDIF IF ($Minute = 0) Say ("$hour") goto (AM_PM) ELSEIF ($minute 1 and $hour<12) say ("a.m.") ELSE say ("p.m.") ENDIF

halt()


ARC Pro

Upgrade to ARC Pro

Stay at the forefront of robot programming innovation with ARC Pro, ensuring your robot is always equipped with the latest advancements.

Author Avatar
United Kingdom
LinkedIn Twitter Google+ YouTube
#1  

Awesome, this should help Josh out with his project too.

Author Avatar
New Zealand
LinkedIn Thingiverse Twitter Google+ YouTube
#2  

Made a few mods so this can be called over and over again without getting confused

------|

Time |

------|

:Initialise $hour_word=$hour say("The time is " )

IF ($hour>12) $hour_word=$hour-12 Elseif ($hour="0" ) $hour_word=12 ENDIF

$hour_word+":"

IF ($Minute = 0) Say ("$hour" ) goto (AM_PM) ELSEIF ($minute <10) Say ("$minute minutes past $hour_word" ) ELSE say("$hour_word $minute" ) goto(AM_PM) ENDIF halt()

:AM_PM IF ($hour<12) say ("a.m." ) ELSE say ("p.m." ) ENDIF

halt()

#3  

Much appreciated Tameion for all your scripts! They are great as is and also for modify/adapting/learning to unique circumstances!

#4  

i think i'll use this as a wake up alarm for my robot! thank you for sharing.:D

#5  

not to mention its beeroclock time!

#6  

@Tameion

When trying to run this script I get a error here?

$hour_word+":"

What am I doing wrong?

Herr

Author Avatar
United Kingdom
LinkedIn Twitter Google+ YouTube
#7  

Try


say("The time is " )

IF ($hour>12)
  $hour_word=$hour-12
ELSE
  $hour_word=$hour
ENDIF

IF ($hour_word=0)
  $hour_word=12
ENDIF

IF ($Minute = 0)
  Say ("$hour_word" )
ELSEIF ($minute <10)
  Say ("$minute minutes past $hour_word" )
ELSE
  say("$hour_word $minute" )
ENDIF

IF ($hour<12)
  say ("a.m." )
ELSE
  say ("p.m." )
ENDIF

Removed some redundant code and fixed a couple of errors. To be honest I'm not sure what the $hour_word+":" was for, it didn't look like it was needed.

Hope you don't mind my doing that @tameion

#8  

@Rich

Sorry but recieved an error too.

Syntax Error on line 12. This command requires 0 parameters. You passed one parameters.

I believe line 12 here is

Else say("$hour_word $minute")