INPUT – Full List of Code Blocks inside Microbit for Beginner

INPUT – Full List of Code Blocks inside Microbit for Beginner

after we discussed the Block code in the Basic section which can be read here https://wisatailmu.com/2025/01/22/basic-full-list-of-code-blocks-inside-microbit/,
now we will discuss the code block in the input section.

2. Input

Blocks for handling physical inputs from micro:bit devices.

Compass Heading

On Micro:bit, “Compass Heading” is a feature to detect heading using the built-in compass sensor (magnetometer). This compass provides a heading value in degrees (0° to 359°) based on the Micro:bit’s orientation relative to magnetic north.

How Compass Heading Works
Heading value:
– 0°: Heading north.
– 90°: Heading east.
– 180°: Points south.
– 270°: Points west.
The compass on the Micro:bit needs to be calibrated before use to ensure accurate readings.
Temperature

On the Micro:bit, the temperature feature allows the device to measure the temperature of the surrounding environment. The Micro:bit’s built-in temperature sensor is actually a sensor contained within the microcontroller, so its measurements reflect the temperature of the Micro:bit board rather than the air temperature directly. However, it is still useful for various experiments.

Explanation
How it works:
1. The temperature sensor measures the temperature of the microcontroller (IC).
2. Its value is calibrated to provide an estimate of the ambient temperature in degrees Celsius (°C).
Limitations:
1. This sensor is not as accurate as an environmental thermometer as it is affected by the heat generated by the device itself.
2. It is not suitable for temperature measurements that require high accuracy.
Sound Level

On Micro:bit, “Sound Level” is used to detect the ambient noise level using the built-in microphone. This feature provides a sound level value as a number, which represents the intensity of the noise.

Sound Level Explanation
The sound level value is in the range of 0 to 255.
– 0: No sound (silent).
– 255: Very loud sound.
The integrated microphone detects noise from the Micro:bit’s surrounding environment.
This data can be used for various applications, such as sound reactive lamps or noise measuring devices.
Calibrate Compass

Compass calibration on the Micro:bit is essential to ensure accurate compass direction (heading) readings. The Micro:bit’s built-in compass sensor needs to be calibrated to correctly recognize the local magnetic field, especially if it is used in a new environment.

How Compass Calibration Works
– The Micro:bit will prompt you for calibration if the compass has not been calibrated or if the compass readings are inaccurate.
– Calibration involves physically moving the Micro:bit in a specific pattern to help the sensor read the ambient magnetic field.

Auto Calibration in MakeCode
– Use the calibrate compass block in the Input category.
– When the program starts, the Micro:bit will display an animated pattern (usually dots forming a circle).
– Move the Micro:bit until all the dots on the screen light up, indicating the calibration process is complete.
Magnetic Force

On the Micro:bit, “Magnetic Force” is used to measure the strength of the surrounding magnetic field using the built-in magnetometer. This sensor can read the magnetic field in all three axes (x, y, z) and generate data in units of microtesla (µT). This data can be used to detect magnetic objects or understand the direction of the magnetic field.

Table of Contents

Comments

No comments yet. Why don’t you start the discussion?

Leave a Reply

Your email address will not be published. Required fields are marked *