From 60b8aa4f1469ee82e87a00e24324e19fff4979fb Mon Sep 17 00:00:00 2001 From: Michael Elliot Braun Date: Mon, 28 Mar 2016 11:28:34 -0700 Subject: [PATCH] rotation animation update --- docs/lessons/rotation-animation/challenges.md | 20 ++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/docs/lessons/rotation-animation/challenges.md b/docs/lessons/rotation-animation/challenges.md index 0090af9f..14bb9d82 100644 --- a/docs/lessons/rotation-animation/challenges.md +++ b/docs/lessons/rotation-animation/challenges.md @@ -49,13 +49,16 @@ while (rotating) { ### Challenge 1 -Now let's add to this by creating a condition for on button pressed `A` before the while loop. +Now let's add to this by creating a condition for on button pressed `A` before the while loop. We will also introduce serial writeLine for the while loop and input OnButtonPressed ```blocks let rotating = true; +input.onButtonPressed(Button.A, () => { + serial.writeLine("hello") +}) while (rotating) { - basic.pause(20) + serial.writeLine("loop") basic.showLeds(` # . . . . . # . . . @@ -85,9 +88,7 @@ while (rotating) { . . . . . `) } -input.onButtonPressed(Button.A, () => { - -}) + ``` @@ -100,8 +101,12 @@ Now that we have the on button pressed condition, let's make the animation stop ```blocks let rotating = true; +input.onButtonPressed(Button.A, () => { + serial.writeLine("hello") + rotating = false +}) while (rotating) { - basic.pause(20) + serial.writeLine("loop") basic.showLeds(` # . . . . . # . . . @@ -131,9 +136,6 @@ while (rotating) { . . . . . `) } -input.onButtonPressed(Button.A, () => { - let rotating = false; -}) ```