Tutorial: Make a Groovy Hand Wash Timer

This is the lede paragraph for the blog post. It should be populated with dynamic data from a WYSIWYG custom field assigned to your posts.

Written by

Kevin Elgan

Published on

BlogTutorials, Uncategorized

In our next skill challenge, we’ll be making a hand wash timer that you can groove to. We’ll also be learning about Skill Design and how to make Chatterbox Stop Audio and Wait.

I think it is safe to say that we all have been washing our hands more than ever before in the history of humankind. The CDC (Center for Disease Control) recommends that you scrub your hands for 20 seconds or “Hum the “Happy Birthday” song from beginning to end twice.”

I don’t know about you, but I’m so tired of singing Happy Birthday that I don’t even want to hear it on my birthday?!

That’s why today we’re going to make a hand wash timer that we can groove to…

How to think about Skill Design (part 1)

So far we’ve built a bunch of skills, but we haven’t discuss the process of designing a skill.

There are 3 main parts to every skill:

  1. How to start (or invoke) the skill?
  2. What to do?
  3. How to respond to the user?

For our hand wash timer, it should follow something similar to:

  1. Say “Start hand wash timer”
  2. Play a song for 20 seconds
  3. Great job for washing your hand!

For the most part this is right. But if we think about it deeper, step #2 could involve multiple steps. Let’s try this out in 3 steps.

How to start the Hand Wash Timer?

Just like we’ve done in previous skills, we are going to start with a Listen block. So far, we’ve used two different Listen blocks.

The When I hear block is listening for specific keywords or keyphrases to match, while the On phrases like block requires similar examples in order to “train” itself to understand the variances between.

For this skill we’ll simply use: “Start hand wash timer”

What are we going to do?

When we say “Play a song for 20 seconds” are we doing one thing or are we doing multiple things? Turns out that language is a little bit tricky sometimes. Humans are able to understand multiple things all at once while computers need to be told all the steps. But if we look closer we’ll see that there are extra steps.

“Play a song for 20 seconds” really means:

  1. Start playing song
  2. Wait for 20 seconds
  3. Stop playing song

Step 1: Luckily, we already know that the Play audio block is how we can easily play audio sounds. For this example we’ll be using this song:

For this example:https://www.youtube.com/watch?v=_NNYI8VbFyY

Step 2: To make Chatterbox wait, you use the Wait block which you can find in the Actions category. This block will wait for an amount of seconds.

Step 3: We’ve learned how to start audio by playing it, but to Stop audio we need a different audio block. Use the audio block with a selector. Set the selector to STOP.

Responding to the User

After 20 seconds of music, we want Chatterbox to speak. For this we use the Speak block and enter what you want the message to be.


Putting it all together

Deploy the skill and try it out! If you didn’t listen to the song yet, you’re in for a nice surprise. 😀

Related Posts