Presentation on theme: "Bug Session One. Session description In this session, pupils are introduced to a programming sequence which will make a light pattern on their Bug. Objectives."— Presentation transcript:
Bug Session One
Session description In this session, pupils are introduced to a programming sequence which will make a light pattern on their Bug. Objectives The students will: Recognise the coordinates of LEDs on the website Bug screen Use a sequence of programming blocks on the Bug Use loops to make their program more efficient Debug any errors in the program Session activities summary Light up an LED Make the LED flash on and off (and describe this as an algorithm) Create a letter L for LED (or B for Bug but this would take longer) Make this flash on and off Make the initial letter of their name flash on and off Resources Bug website Bug software Worksheet Bug Bug cables Bug: Session One 1
Activities Show the class a Bug with an LED flashing on and off What is happening? Record answer as a flow chart or set of instructions such as LED turns on, LED turns off, LED turns on, LED turns off. Tell the class this is an algorithm. 'This is the sequence of things you need to do to make this happen.’ Ask the class to input this set of instructions as a program for their own Micro Bug. Show pupils the website http://bug.iotoy.org/bug/http://bug.iotoy.org/bug/ Click on Create Program button. Select set 'plot' block from 'LED' menu Click on green run button What would happen if I change the x or the y value? Remind pupils of coordinates (English National Curriculum Year 4 ‘Describe positions on a 2-D grid as coordinates in the first quadrant.’) Battle Bug work sheet Pupils work in pairs. Each has a Bug game board with two blank Bugs. Each colours in 3 LEDs on one of their Bugs. The second blank Bug is for each person to record the guesses they have when they try to ‘light up’ their friend’s Bug. Pupils take it in turn to try to ‘light up’ their friend’s LEDs by saying a coordinate. Put an x if a coordinate is wrong. The winner is the first to find the position of all 3 of the LEDs on the other bug. Time 10 minutes 10 minutes (if practice on coordinates is required) 2 Tell pupils that before they begin to program their own Bug, we are going to play a game to remind them of coordinates. How do you use algorithms in every day life? For example: making a cake or finding our way. http://www.bbc.co.uk/ guides/z3whpv4#zx3dwmn http://www.bbc.co.uk/ guides/z3whpv4#zx3dwmn
Bug: Session One Pupils now work at a computer to use the ‘plot’ and 'unplot' blocks to make the LEDs turn on and off. Use coordinates to light up different LEDs on the simulator. Challenge pupils: Can you make an LED turn on and off off? Use the 'plot' and 'unplot' blocks from the LED menu. Remind pupils to insert coordinate values to select the position of the LED. The LED goes off very quickly. Show pupils 'pause' block (under Basic menu) Can they use the 'plot' and 'unplot' bloc on and off three times? k to create a sequence to make the lights flash 10 minutes 3 Top tips! Right clicking on a block lets you duplicate it. You can change the values and varaibles in the blue block by typing into them.
Bug: Session One We have been lighting up one LED. Can you light up LEDs to make an L to stand for LED? Provide pupils that require support with a paper blank Bug to fill in the shape of an L. (You might choose to get them to do B for Bug but this will take longer to program.) Remind pupils they can use right click to duplicate a block. Encourage pupils to keep running the program to check it is working as they want. They don’t need to get to the end before they check. Use the word debug when something does not work as they want it to. ‘It’s not working; we need to debug the program.’ Encourage pupils to spot where it is going wrong and work out how to sort it. If they are still stuck, then encourage them to ask a partner for help BEFORE asking the teacher. What would you need to do to make this flash on and off? Each LED would have to be changed to 0 state. Pauses would have to be added in. You would have to write it all again over and over. 10 minutes 4 Did you know? There is a Bitesize Computing guide called: What is debugging? See: http://www.bbc.co.uk/guides/ See: http://www.bbc.co.uk/guides/ ztkx6sg#zpdthyc There is a more efficient way of doing this.
Bug: Session One Introduce the idea of repeat using a loop. Show this screen shot of the programming to make one LED turn on and off. Can anyone see a pattern in the sequence of blocks? (Chanting the pattern may help some pupils to see that it is repeating.) Show pupils the repeat block in 'Loops' menu and the true block in the 'Logic' menu - some may already have discovered this. Can you use this block to make the LED turn on and off continuously? What’s the difference between this sequence and the sequence you used before? It is much shorter and quicker to write the program and therefore 10 minutes 5 more efficient.
Bug: Session One We have been making one light flash on and off. Your challenge is to light up LEDs to make your initial flash on and off. Install code on the Bug What is the algorithm we will need to follow? Create a guided algorithm by taking ideas from the class and representing them as a flow chart or numbered instructions. 1.Turn on LEDs in the shape of initial 2.Turn off the LEDs 3.Keep repeating this When you have saved your program, transfer it to the Bug 1.Click on the download to Bug link 2.Save the file to a suitable location 3.Open up the Bug Loader software 4.Connect the USB cable to the computer 5.To connect the Bug turn off the Bug (slide the switch downwards) and keep button A pressed. An amber LED will light up to show it is ready. If it doesn’t light up, just unplug it and try again) 6.On the Bug Loader software click on Program Bug! 7.Navigate to the file you saved and select it, it should install on the Bug 8.Disconnect from the USB cable and press the B button to reset the Bug 9.The pattern of LEDs should now light up Your turn to program this on your Bug. 10 minutes 6