Read data from the magnetometer sensor on BBC micro:bit board
[data] = readMagneticField(obj)
Create a connection to the BBC micro:bit hardware connected to the COM4 port., and read the magnetic field along the three axes of the BBC micro:bit hardware.
>>m = microbit('COM4'); >>[data] = readMagneticField(m) data = -33.2 -9.8 -134.8
data— Data read from magnetometer sensor
Three-dimensional data of the surrounding magnetic field intensity. The data is measured along the x-, y-, and z- axes, relative to the position of the board.