Introduction
A barometric pressure sensor can measure the air pressure and temperature around you.Â
In this guide, we will connect a BMP280 barometric pressure sensor to the micro:bit, and program it using MakeCode.Â
Complete this guide to start getting pressure and altitude readings with the BMP280 and micro:bit.
-
-
-
-
-
-
-
-
let pressure = 0 let temp = 0 basic.forever(function () { temp = BMP280.temperature() pressure = BMP280.pressure() basic.showNumber(temp) basic.showNumber(pressure) basic.pause(1000) })
-
let pressure = 0 let temp = 0 basic.forever(function () { temp = BMP280.temperature() pressure = BMP280.pressure() basic.showNumber(temp) basic.showString("degree Celsius") basic.showNumber(pressure) basic.showString("Pa") basic.pause(1000) })
-
let t = 0 let prev_p = 0 let p = 0 let damping = 0 damping = 15 prev_p = Math.round(BMP280.pressure() / damping) basic.forever(function () { p = Math.round(BMP280.pressure() / damping) t = BMP280.temperature() if (p == prev_p) { basic.showArrow(ArrowNames.East) } else { if (p < prev_p) { basic.showArrow(ArrowNames.North) } else { basic.showArrow(ArrowNames.South) } } prev_p = p basic.pause(500) })
-