Teach Event-driven Programming to Primary School Students, in Three Steps.

Introduction: Teach Event-driven Programming to Primary School Students, in Three Steps.

About: Teacher Trainer on using STEM in the classroom

One of the main targets of an ICT teacher at primary school should be to teach young students the basic skills of programming. Along with the three basic programming structures: sequence, selection and repetition, we should also focus on Object Oriented and Event-Driven programming.

In this "instructable" I will present my idea of teaching Event-Driven programming to primary school students. My students had little experience on programming, mainly using code.org activities and building simple MIT Scratch projects. So, it was quite challenging to teach them how Event-Driven programming is working.

My initial idea was to use different activities, increasing the level of difficulty and integration in a progressive way. Moreover, I wanted to use a practical activity in order to demonstrate how Event-Driven programming works. At this age we should always give students practical examples and provide them with the suitable tools to bring their ideas into life. The final lesson plan consists of six 35-minutes lessons, divided into three main sections or steps.


Computer or laptop with internet connection, BBC microbit

Step 1: The Simple Code.org Activities

A good place to start from, is the code.org activities. Most of the activities are quite simple to use and if you explain students the theory hidden behind each activity, then you can achieve impressive results. The most appropriate activity for Event-Driven programming is the Star Wars activity. You can find it following the link here.

The first six levels are quite simple, helping students to adopt to the activity concept, mainly using the sequence structure. Levels 7 and 8 introduce the fist event blocks. The green coloured “when up/down/left/right arrow” event blocks are used to move the droid and thus add interaction with the user.

Levels 9 to 14 use event blocks to build a game scenario. Events for adding or loosing points and others, are gradually introduced as students complete each level. The best part of the activity in my opinion is level 15. Here, students are free to use any events and commands to create their own game. It is the level where students can show their creativity and imagination. But there is a trap. If students do not understand how events work, then they will not know how to use commands and build the code in level 15 and so they will get bored very easily. We completed the Star Wars activities into two lessons, so students got quite familiar with commands. As a result, they created very interesting games in level 15.

Step 2: MIT Scratch

The next step is to use MIT scratch. Building a very simple game is the most appropriate activity to show students how events work. You can start with scratch following the link here.

Since at my class one PC is shared by two students, I used a two-player game. I chose an underwater scenery with a shark and a jellyfish as the two heroes. The scenario is simple: The shark is trying to eat the jellyfish and the jellyfish is trying to escape. One player controls the shark and the other one the jellyfish.

We used the When … key pressed command to make the two objects move with the keyboard. You can see the code for the shark and the jellyfish in the two images presented here.

The activity is very simple, and it was completed in two 35 minutes lessons.

Step 3: The BBC:micro Bit Educational Pcb

The BBC:micro bit pcb offers the practical step of teaching Event-Driven programming. The two push-buttons on the pcb and the accelerometer offer a very easy way of explaining how events work. You can find the environment for programming micro bit following the link here.

An introductory lesson is necessary for the students to get familiar with the features of micro bit and practise with downloading the code to the BBC:micro bit's internal memory. The program presented in the image here, can be used to demonstrate the basic principle of Event-Driven programming. The three events used are button A pressed, button B pressed and shaking the micro bit, detected by the integrated accelerometer. Three different icons are presented on the micro bit's LED array, depending on the input triggered.

During the second lesson, students had also the time to test their own ideas on Event-Driven programming, by changing their initial program.

Step 4: Conclusion

I must say that this was one of my most enjoying and effective series of lessons. In fact, I don’t know if we can talk about a lesson or a game. Technology in our days offers us, teachers, a variety of means to turn our lessons into games. Our job is to take advantage of technology and create game lessons for our students.

Block Code Contest

Participated in the
Block Code Contest

Be the First to Share


    • Box Challenge

      Box Challenge
    • Barbecue Speed Challenge

      Barbecue Speed Challenge
    • Colors of the Rainbow Contest

      Colors of the Rainbow Contest



    4 weeks ago

    Can I get a yearly plan idea on code.org for grade 1st to grade 2 and 3 please.I am from India appointed as ICT teacher in IGSCE board. They said to go through code.org and scratch(for 3rd grade) .I was just discovering scratch yesterday they told to go through code.org.I am getting confused of how to move about and facing health issues as well.please sir help me if possible.


    5 months ago

    Very cool. Thanks for sharing!