From 5d6481a4e8cf47b6e5c0fa152004d7e3fe941cc2 Mon Sep 17 00:00:00 2001 From: Galen Nickel Date: Mon, 9 Jul 2018 11:16:22 -0700 Subject: [PATCH] Fix failing snippets for tele-potato (#938) --- docs/examples.md | 33 ++++++++++++++++----------------- docs/projects/tele-potato.md | 8 ++++---- 2 files changed, 20 insertions(+), 21 deletions(-) diff --git a/docs/examples.md b/docs/examples.md index c48527ab..620dc85a 100644 --- a/docs/examples.md +++ b/docs/examples.md @@ -8,25 +8,25 @@ Here are some fun programs for your @boardname@! [{ "name": "Blinky", "description": "A blinking pattern of LEDs", - "url":"/examples/blinky", + "url": "/examples/blinky", "cardType": "example" }, { "name": "Name Tag", "description": "Scroll your name on the screen", - "url":"/examples/name-tag", + "url": "/examples/name-tag", "cardType": "example" }, { "name": "Rando", "description": "Randomly blinking LEDs", - "url":"/examples/rando", + "url": "/examples/rando", "cardType": "example" }, { "name": "Game of Life", "description": "A Game of Life simulation in LEDs", - "url":"/examples/gameofLife", + "url": "/examples/gameofLife", "cardType": "example" }, { @@ -34,8 +34,7 @@ Here are some fun programs for your @boardname@! "description": "Approximate the number Pi", "url": "/examples/pi-montecarlo", "cardType": "example" -} -] +}] ``` ## Sensors @@ -44,32 +43,32 @@ Here are some fun programs for your @boardname@! [{ "name": "Egg & Spoon race", "description": "Balance a micro:bit like an egg and spoon race", - "url":"/examples/egg-and-spoon", + "url": "/examples/egg-and-spoon", "cardType": "example" },{ "name": "Plot Acceleration", "description": "Chart acceleration on the LED screen", - "url":"/examples/plot-acceleration", + "url": "/examples/plot-acceleration", "cardType": "example" }, { "name": "Plot Light Level", "description": "Chart light level on the LED screen", - "url":"/examples/plot-light-level", + "url": "/examples/plot-light-level", "cardType": "example" }, { "name": "Plot Analog Pin", "description": "Chart analog input on the LED screen", - "url":"/examples/plot-analog-pin", + "url": "/examples/plot-analog-pin", "cardType": "example" }, { "name": "Stop Watch", "description": "Easily track time", - "url":"/examples/stop-watch", + "url": "/examples/stop-watch", "cardType": "example" }, { "name": "Radio Dashboard", "description": "A dashboard for radio clients", - "url":"/examples/radio-dashboard", + "url": "/examples/radio-dashboard", "cardType": "example" }] ``` @@ -80,7 +79,7 @@ Here are some fun programs for your @boardname@! [{ "name": "Servo Calibrator", "description": "Calibrate a servo", - "url":"/examples/servo-calibrator", + "url": "/examples/servo-calibrator", "cardType": "example" }] ``` @@ -91,17 +90,17 @@ Here are some fun programs for your @boardname@! [{ "name": "Turtle Square", "description": "Move in a square", - "url":"/examples/turtle-square", + "url": "/examples/turtle-square", "cardType": "example" }, { "name": "Turtle Spiral", "description": "Move in a spiral", - "url":"/examples/turtle-spiral", + "url": "/examples/turtle-spiral", "cardType": "example" }, { "name": "Turtle Scanner", "description": "Scan down the screen", - "url":"/examples/turtle-scanner", + "url": "/examples/turtle-scanner", "cardType": "example" }] -``` \ No newline at end of file +``` diff --git a/docs/projects/tele-potato.md b/docs/projects/tele-potato.md index 943a2097..2ecfc974 100644 --- a/docs/projects/tele-potato.md +++ b/docs/projects/tele-potato.md @@ -56,7 +56,7 @@ To make the game less predictable, we use the ``||math:pick random||`` block to ```blocks let potato = 0 input.onButtonPressed(Button.AB, () => { - potato = 10 + Math.random(21) + potato = Math.randomRange(10, 20) }) ``` @@ -82,7 +82,7 @@ The **receivedNumber** represents the potato and is stored in the **potato** var ```blocks let potato = 0 -radio.onDataPacketReceived( ({ receivedNumber }) => { +radio.onReceivedNumber(function (receivedNumber) { potato = receivedNumber }) ``` @@ -119,7 +119,7 @@ Get two or more @boardname@s and download the code to them. One player starts th ```blocks let potato = 0 -radio.onDataPacketReceived( ({ receivedNumber }) => { +radio.onReceivedNumber(function (receivedNumber) { potato = receivedNumber }) input.onGesture(Gesture.Shake, () => { @@ -129,7 +129,7 @@ input.onGesture(Gesture.Shake, () => { } }) input.onButtonPressed(Button.AB, () => { - potato = 10 + Math.random(21) + potato = Math.randomRange(10, 20) }) radio.setGroup(1) potato = -1