GRADE 7 · COMPUTING · UNIT 6 · LESSON 6.9

Sequencing and pattern recognition: Getting the message across

Extending a light sequence

Read a little. Try the workbook. Check your answers. Choose one section below to get started.

7 fillable worksheet pagesRead at your own pace

LET’S TRACE, REASON AND TEST

Extending a light sequence

Extending a sequence means inserting a frame in the correct position in both the plan and code. Repeated structures help, but copied image definitions, calls and waits all need checking.

Today’s two goals
  • Extend a flowchart and grid plan by inserting an additional image in the correct position.
  • Edit repeated code structures while preserving the intended order and delays.
Original PaxaKids illustration for Extending a light sequence. Precise program text and data are supplied in the workbook models.
An original PaxaKids workbook scene. Use the supplied programs and data for precise workbook facts.

Explore the clues

Tap one card to find out more.

Understand the idea

Extending a sequence means inserting a frame in the correct position in both the plan and code. Repeated structures help, but copied image definitions, calls and waits all need checking.

Concept to practise: Extending a light sequence.

Work through an example

A vertical sequence becomes left column, middle column, right column, with a 500 millisecond wait after each. The middle definition is useful only when its output call is also placed between the other two calls.

Try before your workbook

A program contains the right three images but shows top, bottom, middle. Is adding the middle-frame definition enough to repair the horizontal sequence?

Check my readiness thinking

No. Reorder the output calls to top, middle, bottom, verify the image definitions and check each delay. Save the repaired revision and retest; a program that parses can still have a sequence error.

Your original programs and learning models

These original PaxaKids program and data models support your workbook. Some examples deliberately contain faults to investigate. Follow their headings and preserve exact code case, punctuation and order. Traces and supplied records are not claims of physical testing.

Extend the sequence without losing its order

Adding a frame means deciding where it belongs in both the flowchart and code. Copying an existing structure can help, but every copied image and delay must be checked.

You will first plan and create a three-frame horizontal sequence, then inspect an original faulty program and repair it against the same target.

See how the vertical example gains a middle frame

The earlier example changed directly from left to right. Insert the middle column between them: left only, middle only, right only. Each frame is followed by a 500 ms wait.

Each five-by-five table gives exact LED brightness digits: 0 is off; 9 is maximum. Rows run top to bottom and columns left to right.

Frame 1: left
Row / column12345
190000
290000
390000
490000
590000
Frame 2: middle
Row / column12345
100900
200900
300900
400900
500900
Frame 3: right
Row / column12345
100009
200009
300009
400009
500009

Read the complete extended vertical example

This original program uses the same output/wait structure three times. The definition of frame_2 supplies the new middle-column image. Its output call is placed between the calls for frame_1 and frame_3.
Original program model
from microbit import *

frame_1 = Image("90000:90000:90000:90000:90000")
frame_2 = Image("00900:00900:00900:00900:00900")
frame_3 = Image("00009:00009:00009:00009:00009")

display.show(frame_1)
sleep(500)
display.show(frame_2)
sleep(500)
display.show(frame_3)
sleep(500)

Plan the three horizontal targets

For the practical, use top, middle and bottom rows in that order. The new middle-row frame belongs between the two earlier horizontal frames. Keep only one row on in each frame.

Each five-by-five table gives exact LED brightness digits: 0 is off; 9 is maximum. Rows run top to bottom and columns left to right.

Frame 1: top
Row / column12345
199999
200000
300000
400000
500000
Frame 2: middle
Row / column12345
100000
200000
399999
400000
500000
Frame 3: bottom
Row / column12345
100000
200000
300000
400000
599999

Inspect the original faulty three-frame program

Open Sequence1Debug_Paxa.py and compare it with page 4. It parses, but the middle-frame position, output-call order and one pause disagree with the intended sequence. First record what this revision actually does, then save and test your repairs.
Original program model
from microbit import *

frame_1 = Image("99999:00000:00000:00000:00000")
frame_2 = Image("00000:00000:00000:99999:00000")
frame_3 = Image("00000:00000:00000:00000:99999")

display.show(frame_1)
sleep(500)
display.show(frame_3)
sleep(50)
display.show(frame_2)
sleep(500)

Practice files for this lesson

Save a copy of these original PaxaKids learner files before editing in suitable software. Some code and datasets deliberately need completion or repair. Downloading a file does not run it. Use invented data; record actual tests separately from predictions. Native software practice files are not print-optimised; use the student PDF for printing.

Paxa the Fox

Try one step with Paxa!

Use supplied fictional records. Do not disclose personal details, upload private photos or bypass browser warnings to complete an activity. Save personal responses before leaving.

Our Unit 6 learning path
  1. Lesson 6.1: Prototyping
  2. Lesson 6.2: Pattern recognition
  3. Lesson 6.3: Patterns between text-based programming languages
  4. Lesson 6.4: Boolean selection and sub-routines
  5. Lesson 6.5: Project plans and test plans
  6. Lesson 6.6: Identifying errors and debugging
  7. Lesson 6.7: Sequences and lights
  8. Lesson 6.8: Creating a moving sequence of lights
  9. Lesson 6.9: Extending a light sequence
  10. Lesson 6.10: Light brightness
  11. Lesson 6.11: Loading-screen and name-sequence extensions
  12. Lesson 6.12: Final project: Sound-triggered visual alarm
  13. Lesson 6.13: Evaluation
  14. Lesson 6.14: What can you do?
For grown-ups: using this lesson

Your answers are checked in your browser. Open responses need grown-up review and are shown separately from the automatic score. Check your work, then use “Retry answers to practise” to revisit mistakes while keeping correct responses.

Read one explanation, discuss the model and try the readiness check before the workbook. Choose “Mark lesson finished” when ready. Optional account progress saves lesson position and completion across devices; save personal responses before leaving.

2. Fill in your workbook

Read the teaching and the complete workbook instructions. Choose, write or draw; Answer list offers larger controls. Trace code precisely and distinguish predictions from actual tests. Review designs, explanations and drawings with a grown-up.

Extending a light sequence7 student pages · original artwork

Opening your PDF…

Swipe sideways across the worksheet on a small screen, or use “Answer list” for larger controls.

TAKE YOUR PRACTICE OFFLINE

3. Download the student worksheet

All 7 original A4 student pages, ready for pencil-and-paper practice. Choose Review Answers to check your work on this webpage.

Student worksheet only · PDF · 8.3 MiB · No answer key included

Download worksheet PDF ↓

TRY FIRST, THEN CHECK TOGETHER

Download the student worksheet →

4. Answers & guidance

Finished your try? Open the guide and compare one worksheet at a time. Your own words may be different and still explain the right idea.

Shown on this webpage only. There is no answer-key download, and this guide is left out when printing the page.

Show answers for all 7 worksheets

Worksheet 1

  1. Question 1: Where should a new middle position be inserted in a left-to-right sweep? between the left and right frames
  2. Question 2: What must be checked after copying a frame section? its image values, position and delay

Worksheet 2

  1. Question 3: Which row string belongs in every row of the middle-column frame? 00900
  2. Question 4: How many distinct frames are planned? 3

Worksheet 3

  1. Question 5: What is the total requested pause time for three 500 ms waits, in milliseconds? 1500
  2. Question 6: Does this finite example clear itself after the last wait? no; the right-column image remains

Worksheet 4

  1. Question 7: Which human row number is lit in Frame 2? 3
  2. Question 8: How many LEDs are lit in each target frame? 5

Worksheet 5

  1. Question 9: Which is the intended order of output calls? frame_1, frame_2, frame_3

Worksheet 6

  1. Question 10: Create your own program for the three horizontal targets on page 4. First draw the ordered flowchart, including each half-second wait and Stop. Encode all five row strings for each frame in the code area or an attached grid plan. Save the complete matching source and identify its filename. Explain where the added middle-row frame belongs relative to the earlier top/bottom sequence. Require all three five-by-five grids: only row1 lit, only row3 lit, only row5 lit; lit row99999 and all others00000. Insert the middle frame after the top frame/wait and before the bottom frame/wait. Flowchart Start, top output,500ms wait, middle output,500ms wait, bottom output,500ms wait,Stop. Exact matching complete source or identified attachment. No implicit endless loop or automatic clear; bottom image remains. Proper symbols and arrows, all25positions per frame. No numeric scores. Grown-up review; personal evidence is required.

Worksheet 7

  1. Question 11: Open and flash Sequence1Debug_Paxa.py, record its actual discrepancy and compare it with your plan. Correct all three faults, save a new revision and flash it again. Record expected versus actual frame positions, order, waits and final image, with a justified outcome for each check. Explain the corrections and retain retest evidence. Mark unavailable transfer or board observations Pending, separating source/simulator preparation from actual device testing. The original frame_2 lights row 4 rather than row 3; the output calls run 1, 3, 2; the middle output-call pause is 50 ms rather than 500 ms. Correct the frame_2 definition, order the calls 1, 2, 3 and use three 500 ms waits. Check top/middle/bottom positions, exactly five lights in each, every cell in all three frames, and the retained bottom image. Keep both source revisions and real expected/actual/retest evidence, or Pending. Source and simulator work are separate from USB and physical-device testing. Do not invent a successful retest. No numeric scores. Grown-up review; personal evidence is required.
Back to my workbook ↑

Curriculum & workbook reference

Computing for your homeschool day

Explore Extending a light sequence with this free Grade 7 Computing lesson. Read one idea together, try the fillable workbook and return to review at your own pace. Download the same student worksheet PDF for pencil-and-paper practice.

Fit learning around your family’s day. There is no timer and no sign-up is needed to use the lesson. An optional account saves your lesson position and completion across devices. Workbook responses and drawings stay in this tab; save a copy of your responses before leaving.

Understand your results

Your answers are checked in your browser. Open responses need grown-up review and are shown separately from the automatic score. Check your work, then use “Retry answers to practise” to revisit mistakes while keeping correct responses.

Choose Review Answers after trying the activity. The guide stays on the webpage; the worksheet download contains only the student pages.

For programme background, visit the Cambridge Lower Secondary Computing overview. PaxaKids provides independent original companion practice.

The book pages identify the related teaching topic. The explanations, characters, programs and exercises here are original PaxaKids companion practice. Practical tasks require the appropriate editor and, where applicable, suitable equipment. A design or paper trace is not a verified hardware result. Only completed, reviewed lessons are listed.

Explore the Cambridge Lower Secondary Computing curriculum for programme background. PaxaKids is an independent learning resource.