Scratch and the Micro:bit

 

This video explains a simple scratch game that uses the BBC micro:bit as a controller. This game uses the BBC micro:bit as a physical computing system as it delivers input and output messages. The input to scratch from the micro:bit is the use of the A and B buttons and also the accelerometer sensors. The output messages are the LED messages displayed on the micro:bit.

This game provides a wide range of activities. Some will be explored in further depth below. Others include code challenges such as giving the children a challenge to add to the game such as a second level or even another micro:bit sensor to be part of the controller such as if the temperature sensor increases then the ice in the game starts to melt.

Below are images of how versatile the micro:bit can be, here the lids have been designed as a fish, a penguin and a tractor. This also provides the opportunity for cross curricular links such as Design and Technology where the children could design a lid for the micro:bit.

 

Unplugged

In this activity the code cards will be printed off in sets for children in pairs. This is a simple introduction to creating algorithms which they can test in their pairs with one child being the ‘controller’ and the other being the ‘character’. This will allow the children to explore code and logical reasoning before even using a computer, this gives an open introduction to scratch and the micro:bit as everyone will be able to join in.

This is an example of decomposed code you could use as the code cards for your unplugged game. Therefore when the children use their logical reasoning to reconstruct this algorithm and sequence they will be able to represented this physically by walking left and right.

A good debugging additional challenge could be is -10 steps left or right? Children will have to reason and use trial and improvement to work this out. One way to support the children is to draw a graph on some paper where the x axis has positive and negative values, they will be able to identify that to positive numbers are on the right and the negative are on the left. This provides a cross curricular link that can reinforce understand learning in maths.

Fix the code.

In this activity the children will have the opportunity to debug the code by using decomposition and logical reasoning. There is something wrong with the code and it needs fixing. Can you break it apart (decomposition) and remove the error by debugging to make the code work.


This is an image of the fixed code. Some ways to ‘bug’ it for your children could be having the incorrect accelerometer value; not including a wait block; having the point in direction face the incorrect way. This will ensure children are using their logical reasoning to identify promblems, they will need to use their debugging skills and decomposition to identify errors and make improvements!

Some key questions to include during this activity could be:

 

“which accelerometer value goes up and down (shake)?”

“how does the direction effect the sprite?”

“what would happen if you changed the numeric value of the accelerometer?”

 

To support children understand which the directions of the x, y and z values you could draw a four quadrant grid on a flat piece of paper. This will show that x is clearly left and right. Y is then forwards and backwards. To identify Z make a small cut in the grid and place a ruler through the middle this will represent the z axis which is up and down movement.

 

Print Friendly, PDF & Email