robjonescowley.files.wordpress.com · Web viewWe use cut off points of North East (NW) is 45...

Post on 30-Apr-2018

217 views 2 download

transcript

Compass

The compass on the microbit can detect which direction it is facing

North (N) is 0 degrees

North East (NW) is 45 degrees

East (N) is 90 degrees

South East (SE) is 135 degrees

South (N) is 180 degrees

South West (SE) is 225 degrees

West (W) is 270 degrees

North West (SE) is 315 degrees

Add a ‘forever’ loop

Add a variable. Call it degrees and set it to equal the compass heading

We will just display the four main directions

Add if, else if and else statements.

Use the less than < to display the compass direction. We use cut off points of

North East (NW) is 45 degrees

South East (SE) is 135 degrees

South West (SE) is 225 degrees

North West (SE) is 315 degrees

Challenge

1. Change the program so that it displays North, East, South, West instead of N, E, S, W2. Use the number of degrees of a 16 point compass to include NE, SE, SW, NW

Answers