From 8a47793f48f70856f2d28646e2ffded74448e075 Mon Sep 17 00:00:00 2001 From: Peli de Halleux Date: Thu, 29 Sep 2016 22:15:04 -0700 Subject: [PATCH] reorg lesson --- docs/projects/timing-gates.md | 43 ++++++++++++++++++----------------- 1 file changed, 22 insertions(+), 21 deletions(-) diff --git a/docs/projects/timing-gates.md b/docs/projects/timing-gates.md index 355c06db..63a88f33 100644 --- a/docs/projects/timing-gates.md +++ b/docs/projects/timing-gates.md @@ -9,6 +9,28 @@ you will need better sensors such as [Hall Effect sensors](https://en.wikipedia. ### ~ +## How does it work? + +The two gates are connected to the micro:bit and can detect a car passing through. + +![](/static/mb/projects/timing-gates/sketchgates.jpg "Sketch of the gates") + +As the car passes through the gate ``0``, it sends an event to the micro:bit through the [on pin pressed](/reference/input/on-pin-pressed) block. +The micro:bit records the time in a variable ``t0``. + +![](/static/mb/projects/timing-gates/sketchgate1.jpg "Sketch first gate") + +As the car passes through the gate ``1``, it sends an event to the micro:bit through the [on pin pressed](/reference/input/on-pin-pressed) block. +The micro:bit records the time in a variable ``t1``. + +![](/static/mb/projects/timing-gates/sketchgate2.jpg "Sketch first gate") + +The rest is a bit of math and physics. The time taken to cross the gates is computed as the difference of ``t1 - t0``. +By dividing the distance between the gates by the duration, we get the speed of the car! + +![](/static/mb/projects/timing-gates/sketchmath.jpg "Sketch math") + + ## Materials * Carboard @@ -37,27 +59,6 @@ control.eventTimestamp(); basic.showNumber(0) ``` -## How does it work? - -The two gates are connected to the micro:bit and can detect a car passing through. - -![](/static/mb/projects/timing-gates/sketchgates.jpg "Sketch of the gates") - -As the car passes through the gate ``0``, it sends an event to the micro:bit through the [on pin pressed](/reference/input/on-pin-pressed) block. -The micro:bit records the time in a variable ``t0``. - -![](/static/mb/projects/timing-gates/sketchgate1.jpg "Sketch first gate") - -As the car passes through the gate ``1``, it sends an event to the micro:bit through the [on pin pressed](/reference/input/on-pin-pressed) block. -The micro:bit records the time in a variable ``t1``. - -![](/static/mb/projects/timing-gates/sketchgate2.jpg "Sketch first gate") - -The rest is a bit of math and physics. The time taken to cross the gates is computed as the difference of ``t1 - t0``. -By dividing the distance between the gates by the duration, we get the speed of the car! - -![](/static/mb/projects/timing-gates/sketchmath.jpg "Sketch math") - ## Building the gate The sensor is made by tapping two strips of fail on the cardboard as close as possible.