Presentation is loading. Please wait.

Presentation is loading. Please wait.

Bug Session Four. Session description Objectives Session activities summary Resources Prior knowledge of sequencing instructions using Bug Bug website.

Similar presentations


Presentation on theme: "Bug Session Four. Session description Objectives Session activities summary Resources Prior knowledge of sequencing instructions using Bug Bug website."— Presentation transcript:

1 Bug Session Four

2 Session description Objectives Session activities summary Resources Prior knowledge of sequencing instructions using Bug Bug website BBC Bug Loader software installed Bug Micro USB cables Bug: Session Four 1 In this session, students are introduced to the idea of selection within computing. The students will: Understand the concept of selection in computing Be able to use an If and Else on the Bug Be able to test a program on the Bug Explanation of selection Show how to create a program using the Bug Install a program onto the Bug Develop their own ideas for the Bug

3 Bug: Session Four Activities What is selection? Time 5 minutes 2 Teacher explanation of selection. The ability of a program to make decisions. Selection is about choice. Ask students to think of decisions that are made daily, such as cars approaching a zebra crossing. The driver makes a decision, IF a pedestrian is at the zebra crossing I stop, ELSE I carry on. Picking sweets from a sweet jar. IF my favourite sweet is in the jar I will have that one, ELSE I will have one of the other sweets. These are examples of selection statements. We can use similar statements when programming a computer. Teacher Demonstration of Bug (You could have a Bug available with the code installed for this session. You can show the class what you would like the outcome of the exercise to be: Selection: Learner plan, included at the back of this session plan). Teacher demonstration of the selection coding for the Bug, Steps 1-4 on the Selection: Learner plan. As you complete each step, ask the students to tell you what they think each instruction will do when run on the Bug. If the class are confident you can start to ask them what instruction might need to come next 10 minutes

4 On task Creating the coding for selection 10 minutes Bug: Session Four At the end of the task ask pupils to test their code. Question the pupils as to what is happening. They should notice it runs through the instructions once and stops. They may suggest adding a loop. Tip: Holding down 'A' or 'B' on the keyboard is the same as pressing button 'A' or 'B' on the emulator. Teacher Demonstration: Complete step 5 from the Selection: Learner plan. This introduces the idea of looping an instruction so that it will check for the input repeatedly. When the input is received the action will be executed. Students: Complete the task with the loop Students: Give students the opportunity to explore the use of selection statements Using the Bug to see how they might be able to use it in interesting ways. Let students know that they will be sharing what they have been able to do with the rest of the class at the end of the lesson. 3

5 Bug: Session Four 4.. 10 minutes Reflecting: What we have learned Ask for volunteers to show their Bug and share what they have learned during the lesson Ask the pupils what they would like to add into their programs to make them better Ask for any ideas of how they think they could make use of the Bug What is an algorithm Notes The student worksheet is intended as an aid to the teacher. Also an important skill to teach children Computational Thinking is the ability to be creative and explore. In this lesson pupils get to use the skills they have learnt in a creative way and can share their experiences with their peers.

6 Bug: Session Four 10 minutes Selection Learner plan

7 Bug: Session Four 1 1 : Choose a selection block First of all we need to choose a selection block. From the IF menu choose the 'if‘ block shown below. We will need to add further blocks to work with this block. The 'If' is able to test whether a condition is true. If it is, it will execute (or run) the instruction or instructions next to 'do'. If the condition tested is false, it will execute (or run) the instruction or instructions next to 'else'.

8 Bug: Session Four 2 2: Provide an instruction Let's provide an instruction so that it can test if a condition is true. In this case we are going to test whether button 'A' is pressed on the Bug. From the Logic menu you need to select the 'equals' comparison block and snap it next to the 'if'. Next, go to the Input menu and choose the 'get button' and the 'string' and block from the Basic menu. Place the 'get button' and nest the 'string' block in the first empty block before the equals sign. From the Input menu choose the 'pressed' block and place this after the 'equals' sign as shown below. These instructions will now check whether 'button A' is pressed. We now need to add the instructions for what it will 'do' if the button is pressed.

9 Bug: Session Four 3 3: Adding text We are going to add text to display on the Bug if button 'A' is pressed. To do this, from the Image menu, choose 'scroll string image' block and snap it next to the 'do'. In the empty block we will need to use the 'make string image'. You should see the message 'Your name'. In the middle of this block, change this to your name, as shown below. This will tell the Bug to scroll ‘Yourname’ across the bug when button 'A' is pressed. We now just need to tell the Bug what to do if button 'A' is not pressed.

10 4: Adding a message The 'else' statement will execute (or run) when the button 'A' is not pressed. So we will add a message to the Bug that will tell the user to press button 'A'. To do this, from the Image menu, choose the 'scroll string image' block and snap it next to the 'do'. In the empty block we will need to use the 'make string image' block. You should see the Message BBC Bug. In the middle of this block, change this to ‘Press Button A’, as shown below. This should now display your name if button 'A' is pressed or else it will display a message asking the user to press button 'A'. Test it on screen. Test it on your Bug. You should find that you see the message ‘Press Button A’ on the simulator and then it stops. The program is running through a sequence of instructions and when it reaches the end it stops. You might also find that if you hold down 'A' on your keyboard and click 'run' on the simulator you will see 'Your name' until it reaches the end when it stops. We need to add further instructions so that it will repeat these instructions. Bug: Session Four 4

11 5: Repeating the instructions To repeat the instructions we will need to use a loop. From the loops menu, choose repeat while. You will need to snap this so that it surrounds all of the other instructions. The from the Logic menu choose 'true' and snap into the top of the 'repeat while' loop, as shown below. Now test the program on your Bug! Remember : You have to keep your finger on button 'A' in order to show your name. Tip: Holding down 'A' or 'B' on the keyboard is the same as pressing button 'A' or 'B' on the emulator. Bug: Session Four 5


Download ppt "Bug Session Four. Session description Objectives Session activities summary Resources Prior knowledge of sequencing instructions using Bug Bug website."

Similar presentations


Ads by Google