Read analog pin voltage on BBC micro:bit board



voltage = readVoltage(microbitObj,pin) reads the voltage on the analog input pin on the BBC mico:bit board, specified as a microbit object.


collapse all

Create a BBC micro:bit object and read voltage from an analog pin.

microbitObj = microbit('COM3');
vp10 = readVoltage(microbitObj,'P10')
vp10 =


Input Arguments

collapse all

BBC micro:bit hardware connection, specified as a microbit object created with the microbit function.

Analog pin number on the BBC micro:bit board, specified as a character vector.

Example: 'P0'

Output Arguments

collapse all

Voltage read from the analog pin on BBC micro:bit board, specified as a numeric double.

Introduced in R2017b