This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

writePWMVoltage

Write PWM voltage value on BBC micro:bit board pin

Syntax

writePWMVoltage(microbitObj,pin,voltage)

Description

example

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.

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

Introduced in R2017b