Table of Contents

analogWriteMax()

analogWriteMax() returns the maximum value available for the specified output channel.

analogWriteMax command operation flow

uint16_t analogWriteMax(uint8_t ch)

Commands

Command Arguments Return Value Operation
analogWriteMax(ch) uint8_t ch uint16_t Returns the maximum value available for the specified output channel.

Example

void setup() {
  analogWriteFreq(3, 1000);  // Set the PWM frequency of the specified output channel.
 
  uint16_t maxValue = analogWriteMax(3);  // Return the maximum value available for the specified output channel.
 
  analogWrite(3, maxValue / 4);  // D46 / OC5A, approx. 25%
  analogWrite(4, maxValue / 2);  // D45 / OC5B, approx. 50%
  analogWrite(5, maxValue);      // D44 / OC5C, 100%
}
 
void loop() {
}

Precautions

Built-in Commands in the Same Category

← Built-in Command List