Step 4 – program the timer
Now we'll program the timer. I'm not going to give you the answer here, but I am going to tell you what to do. Read the points carefully and think – you can do this!
The screenshot at the bottom the page shows you the framework to use.
There are two parts to the program:
Part A:
- do a countdown (you did this in step 3)
- create a variable called start and use it to record the start time (you did this in both step 1 and step 2)
- display a diamond (step 3)
Part B:
- create a variable called end to record the end time (this is shown in the screenshot)
- create a variable called reaction and use it to work out how long the reaction time was (you did this with duration in step 2)
- display the variable reaction (step 2)
Just work through both parts of the program and test it to see if it works.
The framework for the program is here: