New
New
Year 10
OCR

Programming project - Sense HAT II

I can randomly generate pixel colours and use this to create a fortune-telling ball.

New
New
Year 10
OCR

Programming project - Sense HAT II

I can randomly generate pixel colours and use this to create a fortune-telling ball.

These resources will be removed by end of Summer Term 2025.

Switch to our new teaching resources now - designed by teachers and leading subject experts, and tested in classrooms.

These resources were created for remote use during the pandemic and are not designed for classroom teaching.

Lesson details

Key learning points

  1. Static data structures reserve memory locations for a set amount of data. Their size cannot change.
  2. Dynamic data structures are more flexible. The memory capacity is not fixed.
  3. The choice() function can be used to randomly choose an item from a list.
  4. For example, it could randomly pick a pixel from a list storing all pixels in an LED matrix.

Keywords

  • Append - add to an existing data structure

  • Pixel - a single element of an image on a computer screen

Common misconception

A list is static, so once it is created it cannot be edited or amended.

A list is a dynamic data structure that can change in size. The append() function can be used to add elements to a list.


To help you plan your year 10 computer science lesson on: Programming project - Sense HAT II, download all teaching resources for free and adapt to suit your pupils' needs...

If pupils have access to the physical devices of the Raspberry Pi computer and Sense HAT for this lesson, instructions on how to set up this hardware are included as an additional resource for this lesson.
Teacher tip

Equipment

All pupils require access to the Raspberry Pi Code Editor. Pupils could use the physical components of a Raspberry Pi computer and a Sense HAT for this lesson, but they are not essential.

Licence

This content is © Oak National Academy Limited (2025), licensed on Open Government Licence version 3.0 except where otherwise stated. See Oak's terms & conditions (Collection 2).

Lesson video

Loading...

Prior knowledge starter quiz

Download quiz pdf

6 Questions

Q1.
What is the main advantage of using the Sense HAT emulator?

Correct answer: You can practise coding without the physical hardware.
It makes the Raspberry Pi lighter.
It increases battery life.
It prints your code.

Q2.
Which of these is a feature of the Sense HAT?

built-in printer
touch screen
Correct answer: LED matrix for displaying colours
wireless charging

Q3.
Why might you use a list when working with the LED matrix?

to save internet data
to adjust the volume
to store passwords
Correct answer: to control the colour of every pixel

Q4.
What is the part of the Sense HAT that detects things like temperature or movement?

Correct Answer: sensor

Q5.
Match each action to what it does, to complete the sentences:

Correct Answer:Importing the library ...,... lets you use hardware in code.

... lets you use hardware in code.

Correct Answer:Using a list ...,... controls pixel colours.

... controls pixel colours.

Correct Answer:Running code ...,... executes instructions.

... executes instructions.

Correct Answer:Using the emulator ...,... tests your program digitally.

... tests your program digitally.

Q6.
What does the HAT stand for in SenseHAT?

Correct answer: Hardware Attached on Top
High Accuracy Tracker
Heat and Temperature
Hardware Automation Tool

Assessment exit quiz

Download quiz pdf

6 Questions

Q1.
What is the name for the smallest single part of an image on a computer screen?

Correct Answer: pixel

Q2.
What statement describes a static data structure?

It can grow or shrink as needed.
Correct answer: Its size cannot change after it is created.
It stores only numbers.
It is always empty.

Q3.
What function would you use to add an item to a list in Python?

Correct Answer: append()

Q4.
Which statement about lists in Python is true?

Lists are always static and cannot be changed.
Lists cannot use
append()
.
Lists are only for numbers.
Correct answer: Lists are dynamic and can change size.

Q5.
Match each action to its description:

Correct Answer:using `append()`,adds to a list
append()
- 

adds to a list

Correct Answer:using `choice()`,picks an item at random
choice()
- 

picks an item at random

Correct Answer:creating a static array,fixed size

fixed size

Correct Answer:creating a dynamic list,flexible size

flexible size

Q6.
Put these steps in order to add a new item to a list:

1 - create a list
2 - use
append()
to add an item
3 - the list gets bigger
4 - print the list

Additional material

Download additional material