micro:bit sensor values

Issue #148 resolved
Turgut Guneysu created an issue

In the original micro:bit code, the sensors return different values than in microBlocks:

micro:bit microBlocks
acceleration in x, y, and z directions;
as well as the strength of the movement. +/- 1023 single value: +/- 100
tilt in x, y z directions: +/- 180deg tilt in x, y, z directions: +/-100
light level: 0 - 255 light level: 0 - 1000 ?

This variation makes coding rather cumbersome due to range differences.

Any particular reason for the differences?

Comments (4)

  1. John Maloney repo owner

    I’m sorry that these differences in sensor ranges make it a little harder to translate code between MakeCode and MicroBlocks. However, the MicroBlocks design choices were made after careful consideration of many factors, including the desire to be useable by younger children. We also took into consideration the fact that many children using MicroBlocks may be familiar with Scratch, and Scratch tries to use the ranges 0-100 (or -100 to 100) when possible.

    At this point, many people have written code that depends on the current MicroBlocks ranges, and there is a growing body of Activity Cards and other materials that depend on them.

    In short, we don’t plan to change the ranges of those sensors.

    However, someone could create a MakeCode compatibility library that maps between MicroBlocks and MakeCode sensor ranges.

  2. Log in to comment