Introduction
The micro:bit has a number of built-in sensors which include an ambient light sensor, a temperature sensor, an accelerometer, and a compass.
 In this guide, you will learn the basics on how to use these sensors with the MakeCode editor.
 In this guide, you will learn the basics on how to use these sensors with the MakeCode editor.
Complete this guide to get started with using these sensors.
-
-
-
basic.forever(function () { basic.showNumber(input.lightLevel()) basic.pause(100) })
-
-
basic.forever(function () { basic.showNumber(input.temperature()) basic.pause(100) })
-
-
basic.forever(function () { basic.showNumber(input.acceleration(Dimension.Strength)) basic.pause(100) })
-
-
let degrees = 0 basic.forever(function () { degrees = input.compassHeading() if (degrees < 45) { basic.showArrow(ArrowNames.North) } else if (degrees < 135) { basic.showArrow(ArrowNames.East) } else if (degrees < 225) { basic.showArrow(ArrowNames.South) } else if (degrees < 315) { basic.showArrow(ArrowNames.West) } else { basic.showArrow(ArrowNames.North) } })
-