Libraries \ SmoothInterpolate

Reference for Wiring version 1.0 Build 0100+ If you have a previous version, use the reference included with your software. If see any errors or have any comments, let us know.

Name

SmoothInterpolate

Examples
#include <SmoothInterpolate.h>

void setup() 
{
  Serial.begin(9600);
  
  float arr[2] = { 0.0, 1.0}; //from 0.0 to 1.0
  // you start with 2 values, and you have 21 steps between each value
  SmoothInterpolate< 2 , 21 > smoothInterpolate = arr; 
  smoothInterpolate.calculate(); //smooth interpolate
  
  float prev = 0;
  for (int i=0; i<smoothInterpolate.size(); i++) {
    float smoothed = smoothInterpolate[i]; //acces the third value (index 2)
    Serial.print("At ");
    Serial.print(i);
    Serial.print(" value =");
    Serial.print(smoothed);
    Serial.print("tdelta = ");
    Serial.print(smoothed-prev);
    prev = smoothed;
  }
    
}

void loop() 
{

}
Description Make it easy to interpolate smoothly from x to y in z steps (between each value).
Syntax
SmoothInterpolate < start, steps > name
Methods
calculate()
count()
Parameters
start start values
steps steps between each value
name function name
Returns None
Usage Application
Updated on July 07, 2011 11:11:34pm PDT

Creative Commons License