Thursday, 28 November 2013

Lesson 2 - Debugging and Iteration



In today's lesson we are learning to:


  • Understand that computers don’t know what to do do with an error.
  • Write a simple program using text and identify any errors.
  • Iterate/Repeat some code a number of times.


Tasks:


  1. Set up your Raspberry Pi like last lesson.
  2. Log in
  3. Type startx to load the GUI
  4. Open Sonic Pi from the Main Menu under Education.

Your first error

When professional programmers program, 99% of the time they are looking at errors. It is rare for a programmer to write a completely error-free program first time. Let's create an error and see what happens.

Type: pley 40

Press the play button.
Discuss with your partner what happens.

Write a music program using loops:

3. times do
  play 60
  sleep 0.5
end