From 0c40f79decc654f0b402aed1a34ec115f5187a13 Mon Sep 17 00:00:00 2001 From: Tom Ball Date: Sat, 11 Jun 2016 17:12:12 -0400 Subject: [PATCH] three projects down --- docs/projects.md | 8 +++- docs/projects/love-meter.md | 48 +++++++++++++++++++ .../{buttons-smiley.md => smiley-buttons.md} | 0 3 files changed, 54 insertions(+), 2 deletions(-) create mode 100644 docs/projects/love-meter.md rename docs/projects/{buttons-smiley.md => smiley-buttons.md} (100%) diff --git a/docs/projects.md b/docs/projects.md index f2b103a4..3fcaaef7 100644 --- a/docs/projects.md +++ b/docs/projects.md @@ -4,12 +4,16 @@ ![](/static/mb/projects/a1-display.png) -[Flashing Heart](/projects/flashing-heart) +## [Flashing Heart](/projects/flashing-heart) ![](/static/mb/projects/a2-buttons.png) +## [Smiley Buttons](/projects/smiley-buttons) + ![](/static/mb/projects/a3-pins.png) +## [Love Meter](/projects/love-meter) + ![](/static/mb/projects/a4-motion.png) ![](/static/mb/projects/a5-compass.png) @@ -24,5 +28,5 @@ ![](/static/mb/projects/a10-watch.png) -[Rock Paper Scissors](/projects/rock-paper-scissors) +## [Rock Paper Scissors](/projects/rock-paper-scissors) diff --git a/docs/projects/love-meter.md b/docs/projects/love-meter.md new file mode 100644 index 00000000..6190cd6b --- /dev/null +++ b/docs/projects/love-meter.md @@ -0,0 +1,48 @@ +![](/static/mb/projects/a3-pins.png) + +Use pins P0, P1 and P2 to change the display by creating a circuit with your body. + +## Step 1 + +Use [on pin pressed](/reference/input/on-pin-pressed) to show a random number +when pin P0 is pressed (hold the GND pin with other hand): + +```blocks +input.onPinPressed(TouchPin.P0, () => { + basic.showNumber(Math.random(11)); +}); +``` +## Step 2 + +Show a string when pin P1 is pressed: + +```blocks +input.onPinPressed(TouchPin.P0, () => { + basic.showNumber(Math.random(11)); +}); +input.onPinPressed(TouchPin.P1, () => { + basic.showString("LOVE?"); +}); +``` + +## Step 3 + +Show a heart when pin P2 is pressed: + +```blocks +input.onPinPressed(TouchPin.P0, () => { + basic.showNumber(Math.random(11)); +}); +input.onPinPressed(TouchPin.P1, () => { + basic.showString("LOVE?"); +}); +input.onPinPressed(TouchPin.P2, () => { + basic.showLeds(` + . # # # . + # # # # # + # # # # # + . # # # . + . . # . . + `); +}); +``` \ No newline at end of file diff --git a/docs/projects/buttons-smiley.md b/docs/projects/smiley-buttons.md similarity index 100% rename from docs/projects/buttons-smiley.md rename to docs/projects/smiley-buttons.md