PwmWrite/developers

From Wiring

Jump to: navigation, search
This page is intended as a reference for core developers only, and the content is only changed after a consensus has been reached through discussion of any such changes. Please use the Discussion page to talk about any changes or issues you have with the current implementation.
pwmWrite()
Classification PWM Function
Suggested location WPWM.h
C++ required No
Timing constraints None
Version introduced 1.0 (0100)
Framework dependencies None
Prototype(s)
void pwmWrite(uint8_t pin, uint16_t val, uint8_t outputMode)
Required? Yes
Issues None


Contents

Description

The pwmWrite() method sets the value of a PWM output pin.

Black Box Input

The pin number, desired value to be written and the output mode are provided .

Black Box Output

No output.

Overloading

None. Single signature only.

Notes

By default possible values range from 0-255 (see the setPWMResolution() command). On Wiring v1 boards the PWM capable pins are: 29, 30, 31, 35, 36 and 37. On Wiring S board the PWM capable pins are: 4, 5, 6, 7, 19 and 20. Note: analogWrite is an alias for the pwmWrite() command. Doing pwmWrite() on a non PWM pin will cause the pin to be set to HIGH with no other effect.

Proposed Changes

For Wiring 1.1

According to Issue 9, pwmWrite() will be defined as:

void pwmWrite(pin_t pin, uint16_t val, uint8_t outputMode)

See Issue 9 for more details.

Personal tools