From 56301d2d6ff50ade2ca20de82004b9e5c0ca6911 Mon Sep 17 00:00:00 2001 From: Tom Ball Date: Sat, 11 Jun 2016 21:12:08 -0400 Subject: [PATCH] linking in maker activities --- docs/projects.md | 8 +- docs/projects/compass.md | 123 +++++++++++++--------- docs/{ => static/mb}/projects/music-1.png | Bin docs/{ => static/mb}/projects/music-2.png | Bin docs/{ => static/mb}/projects/music-3.png | Bin docs/{ => static/mb}/projects/music-4.png | Bin docs/{ => static/mb}/projects/music-5.png | Bin docs/{ => static/mb}/projects/music-7.png | Bin docs/{ => static/mb}/projects/music-8.png | Bin 9 files changed, 80 insertions(+), 51 deletions(-) rename docs/{ => static/mb}/projects/music-1.png (100%) rename docs/{ => static/mb}/projects/music-2.png (100%) rename docs/{ => static/mb}/projects/music-3.png (100%) rename docs/{ => static/mb}/projects/music-4.png (100%) rename docs/{ => static/mb}/projects/music-5.png (100%) rename docs/{ => static/mb}/projects/music-7.png (100%) rename docs/{ => static/mb}/projects/music-8.png (100%) diff --git a/docs/projects.md b/docs/projects.md index c28634e0..3569aef3 100644 --- a/docs/projects.md +++ b/docs/projects.md @@ -22,15 +22,15 @@ ![](/static/mb/projects/a5-compass.png) -## Music +## [Hack your headphones](/lessons/hack-your-headphones/activity) ![](/static/mb/projects/a6-music.png) -## Conductive +## [Banana keyboard](/lessons/banana-keyboard/activity) ![](/static/mb/projects/a7-conductive.png) -## Network +## [Telegraph](/lessons/telegraph/activity) ![](/static/mb/projects/a8-network.png) @@ -38,7 +38,7 @@ ![](/static/mb/projects/a9-radio.png) -## Watch +## [Watch](/lessons/the-watch/activity) ![](/static/mb/projects/a10-watch.png) diff --git a/docs/projects/compass.md b/docs/projects/compass.md index 381b79c0..b0148c4a 100644 --- a/docs/projects/compass.md +++ b/docs/projects/compass.md @@ -1,83 +1,112 @@ +# compass activity + ![](/static/mb/projects/a5-compass.png) -Use the compass to determine which direction you are heading. +Display the direction that the micro:bit is facing using the compass + +### ~avatar avatar + +Welcome! This guided tutorial will show you how to program a script that displays the direction the micro:bit is pointing. Let's get started! + +### ~ + ## Step 1 -Continuously sample the compass heading and store in the variable `degrees`: +Create a loop that will continuously update the reading of the compass. + ```blocks -let degrees = 0; basic.forever(() => { - degrees = input.compassHeading(); -}); + +}) ``` ## Step 2 -If the degrees is less than 45, we are heading North: +Store the reading of the micro:bit in a variable called `degrees`. ```blocks -let degrees = 0; basic.forever(() => { - degrees = input.compassHeading(); - if (degrees <= 45) { - basic.showString("N"); - } else if (false) { } else { } -}); + let degrees = input.compassHeading() +}) ``` -### Step 3 +## Step 3 -Otherwise, if the degrees is less than 135, we are heading East: +If `degrees` is less than `45`, then the compass heading is mostly pointing toward North. Display `N` on the micro:bit. ```blocks -let degrees = 0; basic.forever(() => { - degrees = input.compassHeading(); - if (degrees <= 45) { + let degrees = input.compassHeading(); + if (degrees < 45) { basic.showString("N"); - } else if (degrees <= 135) { - basic.showString("E"); - } else { } -}); -``` - -### Step 4 - -Otherwise, if the degrees is less than 225, we are heading East: - -```blocks -let degrees = 0; -basic.forever(() => { - degrees = input.compassHeading(); - if (degrees <= 45) { - basic.showString("N"); - } else if (degrees <= 135) { - basic.showString("E"); - } else if (degrees <= 225) { - basic.showString("S"); - } else { } }); ``` -### Step 5 +## Step 4 + +If `degrees` is less than 135, the micro:bit is mostly pointing East. Display `E` on the micro:bit. -Otherwise, we are heading west. ```blocks -let degrees = 0; basic.forever(() => { - degrees = input.compassHeading(); - if (degrees <= 45) { + let degrees = input.compassHeading(); + if (degrees < 45) { basic.showString("N"); - } else if (degrees <= 135) { + } + else if (degrees < 135) { basic.showString("E"); - } else if (degrees <= 225) { + } +}); +``` + +## Step 5 + +If `degrees` is less than 225, the micro:bit is mostly pointing South. Display `S` on the micro:bit. + + +```blocks +basic.forever(() => { + let degrees = input.compassHeading(); + if (degrees < 45) { + basic.showString("N"); + } + else if (degrees < 135) { + basic.showString("E"); + } + else if (degrees < 225) { basic.showString("S"); - } else { + } +}); +``` + +## Step 6 + +If none of these conditions returned true, then the micro:bit must be pointing West. Display `W` on the micro:bit. + +```blocks +basic.forever(() => { + let degrees = input.compassHeading(); + if (degrees < 45) { + basic.showString("N"); + } + else if (degrees < 135) { + basic.showString("E"); + } + else if (degrees < 225) { + basic.showString("S"); + } + else { basic.showString("W"); } }); -``` \ No newline at end of file +``` + +### ~avatar avatar + +Excellent, you're ready to continue with the [challenges](/lessons/compass/challenges)! + +### ~ + diff --git a/docs/projects/music-1.png b/docs/static/mb/projects/music-1.png similarity index 100% rename from docs/projects/music-1.png rename to docs/static/mb/projects/music-1.png diff --git a/docs/projects/music-2.png b/docs/static/mb/projects/music-2.png similarity index 100% rename from docs/projects/music-2.png rename to docs/static/mb/projects/music-2.png diff --git a/docs/projects/music-3.png b/docs/static/mb/projects/music-3.png similarity index 100% rename from docs/projects/music-3.png rename to docs/static/mb/projects/music-3.png diff --git a/docs/projects/music-4.png b/docs/static/mb/projects/music-4.png similarity index 100% rename from docs/projects/music-4.png rename to docs/static/mb/projects/music-4.png diff --git a/docs/projects/music-5.png b/docs/static/mb/projects/music-5.png similarity index 100% rename from docs/projects/music-5.png rename to docs/static/mb/projects/music-5.png diff --git a/docs/projects/music-7.png b/docs/static/mb/projects/music-7.png similarity index 100% rename from docs/projects/music-7.png rename to docs/static/mb/projects/music-7.png diff --git a/docs/projects/music-8.png b/docs/static/mb/projects/music-8.png similarity index 100% rename from docs/projects/music-8.png rename to docs/static/mb/projects/music-8.png