Main Content

writePWMVoltage

Write PWM voltage value on BBC micro:bit board pin

Description

writePWMVoltage(microbitObj,pin,voltage) writes the specified pulse-width modulation (PWM) voltage value to a pin configured for PWM on the BBC micro:bit board, specified as a microbit object.

example

Examples

collapse all

Specify a PWM voltage of 2 volts for pin P7 on the BBC micro:bit board.

microbitObj = microbit('COM3');
writePWMVoltage(microbitObj,'P7',2)

Input Arguments

collapse all

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

Pin number that supports PWM on the BBC micro:bit board, specified as a character vector.

Example: 'P7'

PWM voltage of PWM pin, specified as a real number ranging from 0 to 3.3.

Data Types: double

Version History

Introduced in R2017b