parent
00ad0631aa
commit
036b191f29
@ -29,18 +29,19 @@ This program checks the
|
|||||||
direction to the serial port repeatedly.
|
direction to the serial port repeatedly.
|
||||||
|
|
||||||
```blocks
|
```blocks
|
||||||
|
let degrees = 0
|
||||||
basic.forever(() => {
|
basic.forever(() => {
|
||||||
let heading = input.compassHeading()
|
degrees = input.compassHeading()
|
||||||
if (heading < 45) {
|
if (degrees < 45) {
|
||||||
serial.writeLine("N");
|
basic.showArrow(ArrowNames.North)
|
||||||
} else if (heading < 135) {
|
} else if (degrees < 135) {
|
||||||
serial.writeLine("E");
|
basic.showArrow(ArrowNames.West)
|
||||||
}
|
} else if (degrees < 225) {
|
||||||
else if (heading < 225) {
|
basic.showArrow(ArrowNames.South)
|
||||||
serial.writeLine("S");
|
} else if (degrees < 315) {
|
||||||
}
|
basic.showArrow(ArrowNames.East)
|
||||||
else {
|
} else {
|
||||||
serial.writeLine("W");
|
basic.showArrow(ArrowNames.North)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
```
|
```
|
||||||
|
Loading…
x
Reference in New Issue
Block a user