# Night Sensor Lesson 2

This lesson focussed on the key concepts of decomposition and algorithms (pseudocode and flowcharts) as students begin to build their ‘Night Sensor’ example - a wearable device that will give an audio and visual reminder to a child to ‘be safe, be seen’ at nightfall.

• 年齢 9+
• 60 分
• MakeCode Editor

## カリキュラムリンク

• Computing: Algorithms (pseudocode & flowcharts), decomposition, logical thinking, debugging
• Science: Day and Night / Sensors
• 設計と技術: 製品設計
• Citizenship: Road safety

Skills: Designing, analysing, problem solving, team working.

## Background

It is assumed that you have first completed Lesson 1 of the Night Sensor activity.

## はじめに

This lesson focussed on the key concepts of decomposition and algorithms (pseudocode and flowcharts) as students begin to build their ‘Night Sensor’ example - a wearable device that will give an audio and visual reminder to a child to ‘be safe, be seen’ at nightfall.

## アーカイブ

Algorithm design

• Show students the goal/problem again (slide 6) and depending on students’ experience either as a class or in pairs write a basic, broad algorithm to solve the problem (example on slide 7). Ask questions to test understanding and encourage discussion such as:
• will this be detailed enough for someone to code?
• what would we need to do to make it detailed enough?
• which parts are ambiguous and how would we address that?
• Highlight they have just decomposed the problem into smaller parts and explain they will now design more detailed, accurate algorithms for each part using pseudocode (slide 8).

Team algorithms

• Split the class into their teams and give out the algorithm worksheets (ideally on A3 paper)
• Explain you want them to write a detailed algorithm using pseudocode that someone could follow accurately to write the code for the Night Sensor. They may wish to split the team down to write different sections on rough paper before putting it all together. An simple example is given on slide 9 and a more advanced including a start and stop button and on and off sounds on slide 10
• Depending on previous experience, you may need to spend time going through input and output devices (slide 11) and iteration, loops and selection (slide 12).

Testing and refining algorithms

• Pair up teams and ask them to swop algorithms, test them and give feedback to the other team, comparing and debugging as necessary.
• Come up with a final algorithm as a class, ensuring an appropriate level of detail and accuracy according to your students’ experience and ability and addressing any misconceptions.

Flowcharts

• Invite students to share why creating a flowchart algorithm can also be helpful alongside or instead of pseudocode (graphical representation of algorithm, can be easier for a person to follow and to see decision points).
• Remind students if needed of the standard flowchart symbols (slide 13) and give each team a large sheet of paper and coloured pens. Ask them to create a flowchart for the algorithm and then share, test and debug as necessary as a class (example on slide 14 for the basic algorithm).

Lesson wrap up

• Explain next lesson they will use their algorithms to code the Night Sensor next lesson.
• Ask students a variety of questions to test their understanding (suggestions on slide 15).
• If you wish, use the learning objectives to check progress and understanding (slide 16).

Extension / homework

• Students can add to their learning log and/or working wall if using.
• Students could write pseudocode or flowchart algorithms to solve other everyday problems they encounter (e.g. getting out of bed, doing homework, deciding what film to watch, feeding a pet).

### Differentiation

Support:

• Consider groupings carefully to ensure all students are able to participate
• Encourage students to focus on writing a clear, simple algorithm and supply them with a print and cut out version of the basic algorithm to sequence into place.

Stretch & challenge:

Students can be challenged to include additional detail and elements in their algorithms. For example, can they include the stop/start button and audio sounds straight away in their algorithm and flowchart?

Opportunities for assessment:

• Informal assessment of team algorithms (pseudocode and flowcharts) and use questioning to assess understanding and progress throughout and in lesson wrap up.