This article first appeared in BrickJournal Issue 35, 2015
Adding Personality
While it great achievement to get your robot up and moving, and an even better achievement to have it reacting to its surroundings, sometimes it’s just plain fun to give your bot a little personality. I’m going to outline 2 different ways you can achieve this.
Display Block:
The display block controls the screen of your robot. If you don’t use it, then the screen of your robot just says something boring like – Mindstorms, ProgramA running (or something similar)
The display block allows us to change what is on the screen either by adding some pictures or some words. You’ll find the Display block in the Action pallette (Green Tab). Click on the Display Preview button to see what image will be placed on the screen. Use the Mode switch to choose either Text-Grid or Image. There are other options, but I’ll leave them up to you to discover!
Image Mode: Select an image file from the list of pre-loaded LEGO Image files
Clear Screen: If set as TRUE, it will wipe anything on the screen before displaying the new image. When set to FALSE, it will overlay the new image on top of any previous image
x: Sets the left-hand side of the image. Can be from 0 (very left of screen) to 177 (very right of screen)
y: Sets the upper edge of the image. Can be from 0 (very top of screen) to 127 (very bottom of screen)
Text Mode: I’m using the Text -> Grid mode setting here which allows me to place specific text in a set place on the screen.
Clear Screen: If set as TRUE, it will wipe anything on the screen before displaying the new image. When set to FALSE, it will overlay the new image on top of any previous image
x: This sets which column the text should start. There are 21 columns when in grid mode
y: This sets which row the text should start. There are 11 rows when in grid mode
Colour: Do you want black writing on a white background or white writing on a black background?
Font: There are 3 font’s available; normal, bold and extra large. I prefer extra large as it is much easier to read (although you can’t fit in as much writing!)
TIP: The screen will keep the display you have given it until a new Display Block is run. If the display block is the very last block in a sequence, there is no ‘next block’ so the program shuts down. This means that the Display Block is active for only a fraction of a second and you will barely be able to see it.
Sound Block
While it’s cool to be able to see some images on screen, it is far cooler to have your robot speak! The sound block can be used in 1 of 3 different modes
- Play File – Select from a list of pre-recorded sound clips
- Play None – Set a specific Hz value for a note
- Play Note – Choose a note from a piano keyboard
The one I prefer most (as do all the kids I’ve ever worked with!) is the Play File mode. There are countless different fun sound effects that are pre-loaded into the EV3 software which kids love to scroll through and find the most appropriate (and often very inappropriate) sounds for their programs.
Here’s a simple program that will say “Good Morning”, show some eyes and then start driving. When it encounters an object it will stop, draw a tear in its eye and say “Object Detected”
Debugging
The immediate fun of putting in a bunch of pictures and sound effects into your robot cannot be beaten, but there is a more important reason for including these blocks. Often we find that our programs are getting quite large and it becomes increasingly more difficult to find and fix mistakes. The sounds and display are a great way for the robot to convey information back to us about where in the program it is currently up to. In the above example, if I started my robot and it immediately said “Good Morning Object Detected”, then I could see that there was probably a problem with the Ultrasonic sensor and that it was being triggered early. Without any sounds or images, all I would have would be a robot that didn’t move, but no way to understand why.
Have fun with them, but also use them to help you understand how your program is progressing.
If you have an education related questions (or any questions in general), don’t hesitate to contact me!