0% found this document useful (0 votes)
12 views

MicroBit Final Task

Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views

MicroBit Final Task

Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 5

Step 1: Make it

What is it?
This simple compass will show you which way is North.

How it works

 Your micro:bit has a compass sensor called a magnetometer that measures


magnetic fields. It can sense the Earth’s magnetic field and so you can use it
as a compass.
 When you first use the micro:bit compass you have to calibrate it. A little game
appears on the screen where you have to tilt the micro:bit to light up every
LED, then you’re ready to go.
 The program uses an infinite (forever) loop to keep taking compass readings
and it stores them in a variable called ‘bearing’. It then uses selection: an if…
else statement to show N for North on the LED display if the bearing is greater
(>) than 315 degrees or less than (<) 45. This means that it will show you
where North is as long as your micro:bit is pointing in roughly the right
direction.
What you need

 micro:bit (or MakeCode simulator)


 MakeCode or Python editor
 battery pack (optional)
 a planet with magnetic poles to stand on, such as Earth!

Step 2: Code it

Step 3: Improve it
 Make the compass more accurate by reducing the range of bearings: make the
number 45 smaller and 315 bigger.
 Add other points of the compass to show when the
micro:bit is pointing East, West and South. Must do it
 Can you show more directions?
 Add sound so it makes a noise when pointing North so someone who is
visually impaired can use the compass.
Test your code for all values above

1. Reflection

Place a screenshot here and explain your code


Task 2

2. Create a code to show all numbers from 0 to 1000 using 3


inputs.
Remember: Any decimal number can be written in form of
Units, Tens, Hundreds, etc
Example: 26 = 20 + 6
587 = 500 + 80 + 7

 Press P0 to resent all variables and show the value 0


 Press Button A to add units
 Press Button B to add tens
 Press A+B to add Hundreds
 Press P1 to show the number

3. Test your code. Show to the teacher the following numbers

b) 7
c) 23
d) 112
e) 777
f) 1000
3. Place a screenshot of your code here

4. Change your code to show all negatives numbers up to -1000


5. Test your code. Show the teacher the following numbers
a. -1
b. -25
c. -100
d. -534
e. Place a screenshot of your code here

6. Explain your code and highlight the difference between code 1


positive numbers) with code 2 (negative numbers)

Criteria

You will be assessed on the following criteria

1. Quality of your code


2. Testing tasks
3. Clear reflection and explanation
4. Class work, commitment, and positive attitude
5. Any improvement on your code will carry extra marks

You might also like