Free primary computing remote learning resources

I am in awe of primary teachers who are managing to teach students in school and send out home learning videos and resources at the same time. Thank you and well done!

6 years ago I worked with some amazing primary teachers across York to come up with some resources for the introduction of Computing to the National Curriculum for England including some keyword posters to help with the weird and wonderful words used in the computing programme of study.

To help with remote learning, I’ve put together a load of free online activities that students can do on (almost) any device without needing to sign up or login. They’re all based around keywords and definitions linked to each part of the KS1 and KS2 Computing programme of study.

There are loads of other computing resources out there but I hope that these save someone some time and stress.

Key Stage 1 Computing

Key Stage 1 Computing
Free primary computing remote learning resources for KS1

Key Stage 1 Computing is split into Computer Science, Information Technology and Digital Literacy. You can find keyword games for each learning objective here or play a random game here

Key Stage 2 Computing

Key Stage 2 Computing
Free primary computing remote learning resources for KS2

Key Stage 2 Computing is also split into Computer Science, Information Technology and Digital Literacy. You can find keyword games for each learning objective here or play a random game here.

Free online activities

There are keywords and matching definitions for each learning objective for both KS1 and KS2 Computing. You can share a link to any of the following activities that use these keywords and definitions:

BugZap

Bug Zap free computing games
This activity is really quick for students to do. Click on the right word to zap a bug.

Here’s an example for KS1 and KS2

Eliminate

eliminate: free computing games
This activity is also really quick but makes them think a little more. They have to click on all the words that don’t match the definition.

Here’s an example for KS1 and KS2

Flappy Word

flappy word: free computing games
Are primary children too young to have played flappy bird? This is a shameless copy of the idea where you have to avoid the pipes to collect letters. When you’ve collected enough letters you have to rearrange them to spell the right word.

Here’s an example for KS1 and KS2.

Hangman Definitions

hangman: free computing games
Hangman is a pretty morbid game when you think about it. But undeniably fun. You have to choose the letters to guess the definition of a keyword.

Here’s an example for KS1 and KS2.

Hangman Keywords

hangman: free computing games
This is just like the other hangman game but a little more reading and less guessing. You are given the definition and you have to guess the keyword.

Here’s an example for KS1 and KS2.

Jumble Keyword

jumble: free computing games
This one is great for spelling. You’re given a definition and you have to rearrange the letters into the right order to spell the keyword.

Here’s an example for KS1 and KS2.

Snake

snake: free computing games
My students love this one but I’m not keen. You have to control the snake to collect the letters in the right order to spell your keyword. It takes quite a long time to do but students say it’s fun.

Here’s an example for KS1 and KS2.

Type Race

snake: free computing games
This is probably my favourite. You have to type out the keywords and definitions. The faster you type the faster a little dinosaur runs on the screen. It will work on a touch screen but it’s designed to help build speed and accuracy typing on a keyboard.

Here’s an example for KS1 and KS2.

Word search

word search: free computing games
You can do these on screen by clicking on the first and last letter or you can print them / export as PDFs so you can send them out for students to do offline.

Here’s an example for KS1 and KS2.

Competitions and tracking student progress

All of the activities are designed to work without needing to log in or sign up, but if you make a (free) teacher account then you can create competitions so you can track the score, accuracy and progress for each game. Go to https://tools.withcode.uk/keywords/user/ to create an account or manage your competitions.

Students don’t need to make accounts to take part in your competitions – they’ll be asked to enter their names and a code (which you decide when you make the competition). If you share this code with your students you can keep it private so that only your students can join in.

Students can’t see each other’s names – you’re the only one that can do that. Personal data is encrypted and stored in the UK to be GDPR compliant. You can find out more here or contact me if you have any questions.

Continue ReadingFree primary computing remote learning resources
Try it, debug it, extend it
Try it, debug it, extend it

Python microbit basics: buttons and touch pins

This beginners tutorial talks you through how to write python programs for a micro:bit that can respond when you press a button or touch one of the input pins along the bottom of the device.

Try it with code
Try the code: Python microbit basics: buttons and touch pins

The code below turns a micro:bit into a counter: press button A to count down, button B to count up and touch pin 0 to reset back to 0. Try it out and then read through how it works.

You could use this to keep score in a competition, especially if you use two or more micro:bits – one for each team.

After line 3 imports the micro:bit module so that python can start controlling the inputs and outputs, line 5 and 6 create two new variables: counter  and new_value :

# https://blog.withcode.uk/python-microbit-basics-buttons-and-touch-pins
# micro:bit counter
from microbit import *

counter = 0
new_value = 0

# keep looping forever
while True:
    
    # decrease by 1 if button A was pressed
    if button_a.was_pressed():
        new_value = counter - 1
        
    # increase by 1 if button B  was pressed
    if button_b.was_pressed():
        new_value = counter + 1
        
    # reset to 0 if you touch pin 0
    if pin0.is_touched():
        new_value = 0
    
    # stop counter from going less than 0
    if new_value < 0:
        new_value = 0
        
    # scroll new value if it's changed
    if new_value != counter:
        counter = new_value
        display.scroll(str(counter))
        
    # avoid hogging all the CPU time / using too much power
    sleep(50)

The variable counteris used to store the number that is displayed on the micro:bit at any given time.

The variable new_valueis used to detect if the number has changed so that the new number can be scrolled on the screen.

Both variables store whole numbers only (e.g. 1, 2 or 3, not 1.4, 1.7 or 3.8). We call these types of numbers integers

# https://blog.withcode.uk/python-microbit-basics-buttons-and-touch-pins
# micro:bit counter
from microbit import *

counter = 0
new_value = 0

# keep looping forever
while True:
    
    # decrease by 1 if button A was pressed
    if button_a.was_pressed():
        new_value = counter - 1
        
    # increase by 1 if button B  was pressed
    if button_b.was_pressed():
        new_value = counter + 1
        
    # reset to 0 if you touch pin 0
    if pin0.is_touched():
        new_value = 0
    
    # stop counter from going less than 0
    if new_value < 0:
        new_value = 0
        
    # scroll new value if it's changed
    if new_value != counter:
        counter = new_value
        display.scroll(str(counter))
        
    # avoid hogging all the CPU time / using too much power
    sleep(50)

Lines 9 makes all of the lines that are indented underneath it (lines 10-33) repeat forever.

You can see on line 12 and 16 how to check if a button has been pressed. There are two ways of doing this: button_a.is_pressed()checks to see if the button is currently being pressed at that exact moment in time whereas button_a.was_pressed()checks to see if the button has been pressed at all since last time you checked (or since the program started).

 

Line 20 checks to see if someone is currently touching pin 0. You can test this in the simulator using the I/O pins tab when you run the code in your browser:

How to test the I/O pins one the micro:bit simulator
How to test the I/O pins one the micro:bit simulator

There are 20 pins on the micro:bit that run along the bottom edge of the device. You can find out about each of them on the micropython documentation page but there are four types:

Analog pins: You can input (sense) a value from -1024 to 1024 or output (send) a value in the same range

Digital pins: You can input (sense) if they’re turned on / off, or output (send) an on / off signal to them.

Power pins: These are connected to the 3v power supply and can be used for powering other gadgets like additional LEDs

Touch pins: These are the easiest to use – they can detect the change in capacitance that happens when a human finger touches them so you can use them as touch sensors.

Pins 0, 1 and 2 can be used as touch pins. These are the larger, numbered pins along the bottom of a micro:bit.

# https://blog.withcode.uk/python-microbit-basics-buttons-and-touch-pins
# micro:bit counter
from microbit import *

counter = 0
new_value = 0

# keep looping forever
while True:
    
    # decrease by 1 if button A was pressed
    if button_a.was_pressed():
        new_value = counter - 1
        
    # increase by 1 if button B  was pressed
    if button_b.was_pressed():
        new_value = counter + 1
        
    # reset to 0 if you touch pin 0
    if pin0.is_touched():
        new_value = 0
    
    # stop counter from going less than 0
    if new_value < 0:
        new_value = 0
        
    # scroll new value if it's changed
    if new_value != counter:
        counter = new_value
        display.scroll(str(counter))
        
    # avoid hogging all the CPU time / using too much power
    sleep(50)

Lines 23-25 stop the counter value from going below 0 if you keep pressing button a.

Lines 28-30 might take some explaining:if new_value != counter: checks to see if the new_valueis not equal to counter , which will happen if you’ve just pressed one of the buttons.

display.scroll(…)expects its parameter (the value in brackets) to be a string (which is one or more letters / digits / characters). counter  is an integer (whole number) rather than a string so str(counter)converts the integer into a string so it’ll work with display.scrollproperly.

 

sleep(50)  on line 33 isn’t necessary but it’s a good idea to have it. If you didn’t and you tried to test the code in the simulator, your browser will crash. Testing it on a micro:bit would work but it’d use more battery power than necessary. In both cases, the problems are caused by the while loop repeating so quickly that the CPU is always busy. sleep(50)  just pauses the program for 50ms, which isn’t long, but long enough for your browser / micro:bit to have a breather.

Continue ReadingPython microbit basics: buttons and touch pins
Try it, debug it, extend it
Try it, debug it, extend it

Python microbit basics: How to display images

This beginners tutorial talks you through how to get started displaying and manipulating images on a BBC micro:bit.

 

Try it with code
Try the code: python microbit basics: How to display images

Run the python code below in the micro:bit simulator to see three different ways of showing an image:

The easiest way to display an image is to use a built in image such as Image.HAPPY

from microbit import *

# show built in images
display.show(Image.HAPPY)
sleep(1000)
display.show(Image.SAD)
sleep(1000)

# define your own image on separate lines
i = Image("00000:"
          "22222:"
          "44444:"
          "66666:"
          "88888")
display.show(i)
sleep(1000)

# define your own image on one line
i = Image("88888:66666:44444:22222:00000")
display.show(i)

Lines 4 and 6 show you how to display a built in image. Thesleep(1000) lines pause the program for 1000 milliseconds (1 second) so that the images are on the screen long enough for you to see them. You can find a list of built in images on the documentation page.

Once you’ve tried out some of the built in images, it’s more fun to create your own images:

from microbit import *

# show built in images
display.show(Image.HAPPY)
sleep(1000)
display.show(Image.SAD)
sleep(1000)

# define your own image on separate lines
i = Image("00000:"
          "22222:"
          "44444:"
          "66666:"
          "88888")
display.show(i)
sleep(1000)

# define your own image on one line
i = Image("88888:66666:44444:22222:00000")
display.show(i)

Lines 10-14 creates  a new Image object called i  and sets the brightness of each of the LEDs according to the numbers.

0 for each LED means that it is switched off and 9 means it’s fully on.

You can’t actually set the brightness of a LED by dimming it like a lightbulb, but you can fool the human eye into thinking the brightness of an LED has been changed by switching it on and off very quickly for varying amounts of time. Python does this for you behind the scenes.

from microbit import *

# show built in images
display.show(Image.HAPPY)
sleep(1000)
display.show(Image.SAD)
sleep(1000)

# define your own image on separate lines
i = Image("00000:"
          "22222:"
          "44444:"
          "66666:"
          "88888")
display.show(i)
sleep(1000)

# define your own image on one line
i = Image("88888:66666:44444:22222:00000")
display.show(i)

Line 19 looks a little more confusing but it’s just a more compact way of defining an image than lines 10-14. Each row of the image is separated by a colon (:) and the brightness of each LED is represented by a number from 0 (off) to 9 (full brightness)

Continue ReadingPython microbit basics: How to display images