From fe8eaecaf078f2f9c69f1701ee872a5c7f58fae7 Mon Sep 17 00:00:00 2001 From: Martin Williams Date: Sun, 2 Jun 2024 14:55:05 +0100 Subject: [PATCH] Fix reaction-time code --- docs/projects/reaction-time/code.md | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/docs/projects/reaction-time/code.md b/docs/projects/reaction-time/code.md index ec2d01be35d..114cb4c78bd 100644 --- a/docs/projects/reaction-time/code.md +++ b/docs/projects/reaction-time/code.md @@ -94,12 +94,12 @@ let end = 0 let false_start = false let running = false input.onPinPressed(TouchPin.P0, () => { + running = false + false_start = false basic.showNumber(3) basic.showNumber(2) basic.showNumber(1) basic.clearScreen() - running = false - false_start = false }) input.onPinPressed(TouchPin.P1, () => { @@ -120,12 +120,12 @@ let end = 0 let false_start = false let running = false input.onPinPressed(TouchPin.P0, () => { + running = false + false_start = false basic.showNumber(3) basic.showNumber(2) basic.showNumber(1) basic.clearScreen() - running = false - false_start = false basic.pause(1000 + randint(0, 2000)) }) input.onPinPressed(TouchPin.P1, () => { @@ -150,12 +150,12 @@ input.onPinPressed(TouchPin.P1, () => { }) input.onPinPressed(TouchPin.P0, () => { + running = false + false_start = false basic.showNumber(3) basic.showNumber(2) basic.showNumber(1) basic.clearScreen() - running = false - false_start = false basic.pause(1000 + randint(0, 2000)) if (!(false_start)) { start = input.runningTime() @@ -209,12 +209,12 @@ input.onPinPressed(TouchPin.P1, () => { } }) input.onPinPressed(TouchPin.P0, () => { + running = false + false_start = false basic.showNumber(3) basic.showNumber(2) basic.showNumber(1) basic.clearScreen() - running = false - false_start = false basic.pause(1000 + randint(0, 2000)) if (!(false_start)) { start = input.runningTime() @@ -242,12 +242,12 @@ let end = 0 let false_start = false let running = false input.onPinPressed(TouchPin.P0, () => { + running = false + false_start = false basic.showNumber(3) basic.showNumber(2) basic.showNumber(1) basic.clearScreen() - running = false - false_start = false basic.pause(1000 + randint(0, 2000)) if (!(false_start)) { start = input.runningTime()