   display.setCursor(0,0);  
 
 
+  powerValuesTotal = powerValuesTotal - powerValues[powerValuesIndex];         
+  powerValues[powerValuesIndex] = outputWattRaw;
+  powerValuesTotal = powerValuesTotal + powerValues[powerValuesIndex];       
+  powerValuesIndex++;                    
+
+  // if we're at the end of the array...
+  if (powerValuesIndex >= PAST_POWER_TO_AVERAGE) {
+    powerValuesIndex = 0;                           
+  }
+
+  powerValuesAverage = powerValuesTotal / PAST_POWER_TO_AVERAGE;         
+
+
+
+
   display.print("Out Power:   ");
-  display.print(outputWatt, 3);
+  display.print(powerValuesAverage, 3);
   display.println("W");
   
   display.println();

  String output = "";
  char buff[10];
  
  String outputWattString = dtostrf(outputWatt, 0, 3, buff);
  output += outputWattString;
  output += " ";


#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>

#define POLL_RATE 100
#define SCREEN_RESET_PIN 4 //Digital 4
#define DISPLAY_CONTRAST true
#define PAST_POWER_TO_AVERAGE 10

Adafruit_INA219 ina219;
Adafruit_SSD1306 display(SCREEN_RESET_PIN);

//Smoothing algorithm http://arduino.cc/en/Tutorial/Smoothing
float powerValues[PAST_POWER_TO_AVERAGE];      // the readings from the analog input
int powerValuesIndex = 0;                  // the index of the current reading
float powerValuesTotal = 0;                  // the running total
float powerValuesAverage = 0;                // the average

void setup(void) 
{
