Articles Posted by the Author:

  • randomSeed()

    randomSeed()

      randomSeed(seed) Description randomSeed() initializes the pseudo-random number generator, causing it to start at an arbitrary point in its random sequence. This sequence, while very long, and random, is always the same. If it is important for a sequence of values generated by random() to differ, on subsequent executions of a sketch, use randomSeed() to […]


  • tan()

    tan()

      tan(rad) Description Calculates the tangent of an angle (in radians). The result will be between negative infinity and infinity. Parameters rad: the angle in radians (float) Returns The tangent of the angle (double) See also sin() cos() float double Reference Home Corrections, suggestions, and new documentation should be posted to the Forum. The text […]


  • cos()

    cos()

      cos(rad) Description Calculates the cos of an angle (in radians). The result will be between -1 and 1. Parameters rad: the angle in radians (float) Returns The cos of the angle (“double”) See also sin() tan() float double Reference Home Corrections, suggestions, and new documentation should be posted to the Forum. The text of […]


  • sin()

    sin()

      sin(rad) Description Calculates the sine of an angle (in radians). The result will be between -1 and 1. Parameters rad: the angle in radians (float) Returns the sine of the angle (double) See also cos() tan() float double Reference Home Corrections, suggestions, and new documentation should be posted to the Forum. The text of […]


  • sqrt()

    sqrt()

      sqrt(x) Description Calculates the square root of a number. Parameters x: the number, any data type Returns double, the number’s square root. See also pow() sq() Reference Home Corrections, suggestions, and new documentation should be posted to the Forum. The text of the Arduino reference is licensed under a Creative Commons Attribution-ShareAlike 3.0 License. […]


  • pow()

    pow()

      pow(base, exponent) Description Calculates the value of a number raised to a power. Pow() can be used to raise a number to a fractional power. This is useful for generating exponential mapping of values or curves. Parameters base: the number (float) exponent: the power to which the base is raised (float) Returns The result […]


  • map()

    map()

      map(value, fromLow, fromHigh, toLow, toHigh) Description Re-maps a number from one range to another. That is, a value of fromLow would get mapped to toLow, a value of fromHigh to toHigh, values in-between to values in-between, etc. Does not constrain values to within the range, because out-of-range values are sometimes intended and useful. The […]


  • constrain()

    constrain()

      constrain(x, a, b) Description Constrains a number to be within a range. Parameters x: the number to constrain, all data types a: the lower end of the range, all data types b: the upper end of the range, all data types Returns x: if x is between a and b a: if x is […]


  • abs()

    abs()

      abs(x) Description Computes the absolute value of a number. Parameters x: the number Returns x: if x is greater than or equal to 0. -x: if x is less than 0. Warning Because of the way the abs() function is implemented, avoid using other functions inside the brackets, it may lead to incorrect results. […]


  • max()

    max()

      max(x, y) Description Calculates the maximum of two numbers. Parameters x: the first number, any data type y: the second number, any data type Returns The larger of the two parameter values. Example sensVal = max(senVal, 20); // assigns sensVal to the larger of sensVal or 20 // (effectively ensuring that it is at […]