Challenge: How do we teach Chatterbox how to ‘Listen’ and ‘Speak’?
Chatterbox is a smart speaker that can listen and speak based on simple instructions. Each set of instructions is called a “Skill” or something that Chatterbox can do. Skills are basic programs that you code using visual blocks.
Chatterbox only listens when you push the big yellow button on its head. But it only listens for the things that you teach it.
How to Make Chatterbox Listen
To make Chatterbox listen for a specific word or phrase, you use the ‘When I hear’ block. In the example pictured above, Chatterbox will listen for “hello.” Once it hears “hello,” it will trigger anything contained inside the block.
Important: The ‘When I hear’ block is the starting point for all skills. Unless Chatterbox, hears the key word or phrase, it won’t do anything except say the default message “I don’t know how to do that, but you can teach me.”
How to Make Chatterbox Speak
The ‘Speak’ block is how you make Chatterbox speak a word or phrase. But the block will only work when combined with the ‘When I hear’ block.
You can also stack multiple ‘Speak’ blocks in a row to have them speak in order.
You can change things up with a bit of randomness by using the ‘Speak Random’ block. When using this block, Chatterbox will choose at random only a single phrase from the block.
The example above will only speak “Heads” or “Tails” but not both.
Take the Matrix Challenge
If you’ve seen the Matrix movie, Morpheus asks Neo which pill he would like to take to discover what the matrix is. Let’s make a skill to help Neo decide which pill to take.
Place the ‘Speak Random’ block inside the ‘When I hear’ block as pictured below.
Before you can test it out, you need to save your work by pressing the DEPLOY button on the top right.
Result: After pushing the button and asking the question, Chatterbox should respond with either “Red pill” or “Blue pill.”
You can combine these three blocks to make all sorts of skills. Below are a couple ideas to get you started:
Tell me a joke
Flip a coin
Ask the crystal ball