Arduino Programming Language: Max

Name

max()

Description

Calculates the maximum of two numbers.

Syntax

max(x,y)

Parameters

  • x: the first number, any data type
  • y: the second number, any data type

Returns

 The larger of the two parameter values

Examples

sensVal = max(senVal, 20); // assigns sensVal to the larger of sensVal or 20
// (effectively ensuring that it is at least 20)

Related Functions


Based on the reference originally written by Arduino Community,  wiring.org.co and  arduino.cc