Fix compass doc errors (#721)
* Fix compass doc errors * Another heading point error
This commit is contained in:
		
				
					committed by
					
						
						Peli de Halleux
					
				
			
			
				
	
			
			
			
						parent
						
							f70665d1a0
						
					
				
				
					commit
					0ec922c7f4
				
			@@ -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")
 | 
			
		||||
    }
 | 
			
		||||
})
 | 
			
		||||
```
 | 
			
		||||
 
 | 
			
		||||
@@ -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)
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
@@ -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)
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user