Main Content


Write to digital pin on BBC micro:bit board



writeDigitalPin(microbitObj,pin,value) writes the value to the pin on the BBC mico:bit board, specified as a microbit object.


collapse all

Write a value to digital pin P5.

microbitObj = microbit('COM3');

Input Arguments

collapse all

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

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

Example: 'P5'

Value of digital data to write to the specified pin on BBC micro:bit board, specified as a logical value of 0 and 1 or true and false.

Introduced in R2017b