micro:bit Revision Guide for Assessment PDF
Document Details
Uploaded by HappyMint
OCR
Tags
Summary
This document is a revision guide for the micro:bit, covering practical and theoretical aspects of programming. It details elements like variables, selection statements, inputs, and sensors. This guide comes with coding tasks.
Full Transcript
micro:bit revision Guide for Assessment Practical The assessment will contain a practical element which will require you to complete coding tasks Please see your OneNote and complete the tasks on the makecode editor you have been using Theory: Variables Variables are Assigned to a value...
micro:bit revision Guide for Assessment Practical The assessment will contain a practical element which will require you to complete coding tasks Please see your OneNote and complete the tasks on the makecode editor you have been using Theory: Variables Variables are Assigned to a value Can be called anything (but should be a sensible name) Can hold a string or a number Can change over the course of a program Using Variables We are s e tting the va lue of “count” at the start of the program We then a c c e s s the va lue and display it in the forever loop We c ould ha ve give n the va ria ble a ny name e.g. “thing”, “banana”, “nonsense” and the c ode would work the s a m e BUT va ria ble na m e s s hould be m e a ningful We will use “count” to store the number of times we press a button Theory: Selection (if/else) Selection takes place using if/else if/ else The first condition to hold true will trigger the inner statement i.e. if the ‘if’ condition is true, the else if and else conditions won’t be evaluated The condition for each statement must evaluate to true or false You can test for 2 different conditions to hold true in an ‘if’ statement Theory: Inputs Inputs are anything which can change the program as it runs – e.g. clicking Button A or the light/temp sensor. Changes in these can influence the output of the program. The program will always be ‘listening’ for button presses or temperature changes etc. Inputs: Sensors Sensors convert natural phenomena into a range of electrical signals which can be represented by numbers Micro:bit tends to have a range of 0-255 Sensors change natural phenomena into a numerical measurement using Analogue to Digital Converters (ADCs) Sensor data is gathered through the input library (right) Sensing the real world Your micro:bit’s light sensor uses light energy to alter an electrical signal which can be converted to a number Converting the physical level to a number so that it can be used by a computer is known as Analogue to Digital conversion How can a computer tell the difference between sound levels? By re pre s e nting the s ound da ta a s a num be r Using two wires, you could detect 4 different sound wave amplitudes from your microphone sensor…how many different levels of sound could you detect using 3 wires? on VERY LOUD!! = on on Loudis h = off off Quie tis h= on off very quiet= off Math Make sure you are comfortable doing calculations on your data from the sensors E.g how would you convert Celsius to Fahrenheit? °F = 1.8°C + 32 Radio Familiarise yourself with how to create a radio channel and how to send and receive over the channel (your emulator is useful here alongside the next 2 slides and task 3 in OneNote) Different radio channels work on different frequencies. So you need to set your own radio group – the same group will share the same frequency. Decide what channel you want your group to be (1 – 255) and set the channel. Se nde rs Re c e ive rs You should have something You should have something like… like… Can you figure out the range of Can you figure out the range of the radio? Estimates to the the radio? Estimates to the nearest 50cm will do. nearest 50cm will do. GOOD LUCK!