Want to create or adapt books like this? Learn more about how Pressbooks supports open publishing practices.
3 Communicate with Zumi
Learning Outcomes
Describe the hardware components of Zumi, including its screen and buzzer.
Explain the characteristics of Zumi’s LED-based screen, including the number of LEDs on the circuit board (8 LEDs).
Demonstrate the various applications and functions of Zumi’s front and back lights, such as using them for headlights, brake lights, hazard lights, and turn signals.
Zumi Screen
Almost every single device that you own probably has a screen. Cellphones, laptops, tablets, televisions, and now your Zumi! Screens come in all sizes and types. Some are color and some are black and white. Your Zumi screen can only display black and white, but you can still use it to write messages, draw pictures, and make silly faces. Open the “Screen” menu to see all of the blocks.
Draw text
When you turn on Zumi, she gives you some helpful messages on the screen to help you get started. You can write your own messages using the draw text block. Have Zumi say hello!
Add the eyes
Now, have Zumi greet you and display her happy eyes. To make sure that the message stays on the screen long enough to read, add a “Wait” block in between.
Goodbye!
Now try changing the text and the eyes to say “Goodbye!” Also, display Zumi’s close eyes because she is tired and needs to say goodbye!
Sounds
Zumi has a buzzer so that she can make sounds! While she wouldn’t be able to play your favorite song or talk to you, you can play individual notes that can sound happy, sad, or surprised. In the “Sounds” menu, we’ve made some sounds for you. Try them out!
Combine sounds and screen
Have Zumi say hello, make a sound, and show her happy eyes! You can put the blocks in any order you want, but remember that the code will only run one at a time.
Custom sounds
If you want to write your own sounds and music, you can use the play note block. To use this block, you need to know which note you want to play. If you play an instrument, you may be familiar with the notes names. If you need some help, take a look at this diagram of a keyboard. The black keys are described a “Sharp” above its neighboring key on the left.
Let’s play middle C for 1 second. Middle C is a note around the middle of the piano. It’s not too low or too high. The first parameter in the block is the note and the second parameter is the duration the note will play in milliseconds. There are 1000 milliseconds in 1 second.
Here is an example of playing all of the natural notes (white keys) in one octave.
To play a sharp (black key), select a note with the “S”. Here is an example of a tune for Zumi’s sad eyes.
Zumi LEDs
Like every car should have, Zumi has headlights and brake lights that you can program. On a circuit board, these are called LEDs. Zumi has 8 LEDs on the board, but you can’t program all of them. In this lesson, you are going to program the front and back LEDs. The front LEDs are a bit hidden by the shell. Do not get them confused with the infrared sensors!
The back LEDs are much easier to see. They are the red ones on the back of Zumi.
LED functions
Open the “Lights” menu to see all of the different functions. You can turn on headlights, brake lights, and use signals!
Activity: Use signals while driving
Cars need to let other drivers on the road when they are turning or slowing down. Practice turning on your right turn signal, driving forward, waiting, and then making a right turn and continuing down the road. Don’t forget to turn off the turn signal!
Review
You can now draw eyes and messages on the screen, make some sounds, and add some lights! You may be wondering about making custom eyes, but you will get to that later. For now, test your knowledge by coding your own sound effects for each face, or use Zumi to act out a story driving through town complete with turn signals and messages on the screen.
Test Your Knowledge
Review The Key Concepts
Solve The Problem
Scenario: You would like to test your autonomous vehicle on public roadways, although your car knows where it is going, it needs a way to communicate with other drivers sharing the road.
Problem: How can Zumi communicate with drivers on the road? How can Zumi communicate with other vehicles on the road?
Sample Solution
There are many different ways that we can solve the problem listed above. Please watch the following video to review a sample solution completed by Ontario Tech University Engineering Students.
Demo
Code
Common Errors
Errors can also occur while creating a solution to the problem. Please review the video below to view some of the common errors that can occur.