LEGO Mindstorms EV3 Fun Project - Learn How to Program in EV3
In our programming courses for kids, like Scratch and EV3 and NXT
courses, we love to make the learning path more fun. Because fun
learning experience can help kids to get higher motivation and last for
longer time. This article is based on our pratical experience in EV3
robotics course to show how to teach touch sensor step by step and help
students learn to build a fun game with EV3 touch sensor. Students love
this game so much! If you have a new and cool EV3 Brick, please try to
follow the steps to learn interesting touching game. NXT works as well!
The download link of EV3 sample code for this article is at bottom.
Please DOWNLOAD it. You may get inspired how to make your own fun game!
Step 1 make a simple tone - Let students write a simple program to let the EV3 brick make a simple short note. It's just a Sound block as below:
Step 2 wait for press and make a tone - Modify the program
of Step 1 to wait for user press the touch sensor. Choose 2 (bumped) for
action of touch sensor. Please check below:
Step 3 add a loop - It is quite strange for playing just a
short note. It should response to users a beep whenever user click the
touch sensor. How we can do? Let students make a try and we can wait to
see anything good happen. A loop block need to be introduced here. We
can make a name for this loop. A good name can be a maker to be found in
EV3 software.
Step 4 Time challenge 10 seconds - Make the loop last for
excat 10 seconds. When time up, EV3 brick play a interesting sound, like
"Bravo" to let user know game is over. The program is as below. But,
how can we know how many times we click?
Step 5 count user's click and display - The concept of
variables is somehow hard to students. Because understanding of
variables requires user to think abstractly and logically. We just start
from "A = A + 1". Let students learn from copying teachers' work to
increase variable "count" everytime when enter the loop. And display
"count" on the screen. Also wait for 5 seconds before exit of the
program to get user have enough to learn the total click has been made.
Step 6 the number on the EV3 screen are fewer than user's click.
- Students will might have the problem in their touch sensor game. By
introducing edge detection for state change (one block for unpressed
-> pressed and one block for pressed -> unpressed), EV3 brick can
handle user's click much better. Program are as below.
Step 7 make ascend tone - When the number goes up, the tone frequncy is up. Higher tone make the player more nervous and excited.
Step 8 two players - Can we make this game for two players?
The EV3 brick can show who is the winner after 10-second play. This will
be advanced homework for kids to complete.
Many students learn the loop and control LEGO
robotics in their own way. However, as a game deverloper, I am happily
to make the course more fun and make gamification of LEGO
robotics course. If we design a game rule to make users play. Users can
try to click the rouch sensor in 10 seconds and compete who the winner
is among peers. Students can play and compete while learning to program
EV3. When they play with their work, they will focus on make their own
game better and easily ignore the hard part of software programming. :)
Download EV3 Sample code: http://www.thumb.com.tw/images/blog/lego_ev_touching_game/thumb_touching_game.ev3