From 0ec922c7f4216838437d126d7aebfaabda466ca2 Mon Sep 17 00:00:00 2001 From: Galen Nickel Date: Tue, 27 Mar 2018 15:02:38 -0700 Subject: [PATCH] Fix compass doc errors (#721) * Fix compass doc errors * Another heading point error --- docs/reference/basic/forever.md | 15 ++++++++------- docs/reference/input/compass-heading.md | 8 ++++---- docs/reference/serial/write-line.md | 4 ++-- 3 files changed, 14 insertions(+), 13 deletions(-) diff --git a/docs/reference/basic/forever.md b/docs/reference/basic/forever.md index a9202548..c7f9bfb6 100644 --- a/docs/reference/basic/forever.md +++ b/docs/reference/basic/forever.md @@ -15,18 +15,19 @@ The following example constantly checks the and updates the screen with the direction. ```blocks +let degrees = 0 basic.forever(() => { - let heading = input.compassHeading() - if (heading < 45) { + degrees = input.compassHeading() + if (degrees < 45) { basic.showString("N") - } else if (heading < 135) { + } else if (degrees < 135) { basic.showString("E") - } - else if (heading < 225) { + } else if (degrees < 225) { basic.showString("S") - } - else { + } else if (degrees < 315) { basic.showString("W") + } else { + basic.showString("N") } }) ``` diff --git a/docs/reference/input/compass-heading.md b/docs/reference/input/compass-heading.md index 799410bf..849bbafe 100644 --- a/docs/reference/input/compass-heading.md +++ b/docs/reference/input/compass-heading.md @@ -2,7 +2,7 @@ Find which direction on a compass the @boardname@ is facing. -The @boardname@ measures the **compass heading** from `0` to `360` +The @boardname@ measures the **compass heading** from `0` to `359` degrees with its **magnetometer** chip. Different numbers mean north, east, south, and west. @@ -12,7 +12,7 @@ input.compassHeading(); ## Returns -* a [number](/types/number) from `0` to `360` degrees, which means the compass heading. If the compass isn't ready, it returns `-1003`. +* a [number](/types/number) from `0` to `359` degrees, which means the compass heading. If the compass isn't ready, it returns `-1003`. ## Example @@ -43,11 +43,11 @@ basic.forever(() => { if (degrees < 45) { basic.showArrow(ArrowNames.North) } else if (degrees < 135) { - basic.showArrow(ArrowNames.West) + basic.showArrow(ArrowNames.East) } else if (degrees < 225) { basic.showArrow(ArrowNames.South) } else if (degrees < 315) { - basic.showArrow(ArrowNames.East) + basic.showArrow(ArrowNames.West) } else { basic.showArrow(ArrowNames.North) } diff --git a/docs/reference/serial/write-line.md b/docs/reference/serial/write-line.md index ef5c46d0..f7528ec8 100644 --- a/docs/reference/serial/write-line.md +++ b/docs/reference/serial/write-line.md @@ -35,11 +35,11 @@ basic.forever(() => { if (degrees < 45) { basic.showArrow(ArrowNames.North) } else if (degrees < 135) { - basic.showArrow(ArrowNames.West) + basic.showArrow(ArrowNames.East) } else if (degrees < 225) { basic.showArrow(ArrowNames.South) } else if (degrees < 315) { - basic.showArrow(ArrowNames.East) + basic.showArrow(ArrowNames.West) } else { basic.showArrow(ArrowNames.North) }