Debugging

Lesson 6 - Year 3

Learning Intention

  • I can test and debug my programs

Introduction

This week we will be testing all the programs we have written by running them on Picoh the robot. If the programs do not make sense, Picoh will not work. If this is the case you need to debug the program and test it again until Picoh performs the moves you intended.

Teacher Input

The set speed to instruction on the Motion palette

There are some differences between using the simulator in the Picoh program and using a physical robot. On the Motion palette there's an instruction we have not yet used because it only applies to the physical robot. Which instruction do you think it is? (`set speed to`.)

The simulator works at a constant speed. However, the motors on the robot take some time to move. This instruction allows you to adjust the speed of the motor. Picoh has 3 motors, and like all Picoh instructions the value you can input ranges between 0 and 10. As Picoh needs more time to complete a move using a physical robot, you may need to increase the wait times to allow it to finish a move before it starts the next one, particularly when using head nod and head turn.

Divide the class into equal sized groups and send them to the workstations where Picoh has been set up. Children take it in turns to log on and run 4 or 5 of the programs they have written this half term. Do the programs work? Can they debug the program to fix it? Remind them of the need to take turns.

Activities

1.

Test and debug the code you have written, on the simulator or on the physical Picoh robot.

Extension

Can you add any new code to any of your programs to improve them?

Plenary

Evaluation of the Picoh project. Children to complete the following feedback.

Picoh project evaluation feedback sheet
Ohbot image

Key Points

  • The simulator runs at a constant speed; a physical robot's motors take real time to move.
  • `set speed to` (Motion palette) only affects the physical robot.
  • Physical robots often need longer `wait` times than the simulator.
  • Test, compare with what you intended, then change one thing at a time.

Need Help?

If you're stuck on any part of this lesson, check out these resources:

Ohbot