robjonescowley.files.wordpress.com · web viewwe use cut off points of north east (nw) is 45...

4
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

Upload: doantruc

Post on 30-Apr-2018

217 views

Category:

Documents


2 download

TRANSCRIPT

Page 1: robjonescowley.files.wordpress.com · Web viewWe 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)

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

Page 2: robjonescowley.files.wordpress.com · Web viewWe 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)

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

Page 3: robjonescowley.files.wordpress.com · Web viewWe 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)

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

Page 4: robjonescowley.files.wordpress.com · Web viewWe 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)

Answers