         flowing = false;
       previousPulseCount = pulseCount;
       previousSecond = currentSecond;
-      Serial.println(previousPulseCount);
-      Serial.println(pulseCount);
-      Serial.println(flowing);
-      Serial.println("================");
   }
 }
 

#define EEPROM_ADDR_PULSE_COUNT 1
#define EEPROM_ADDR_MAX_PULSE_COUNT 2
#define EEPROM_ADDR_PERCENT_FULL 3
#define PIXEL_PIN D2
#define PIXEL_TYPE WS2812B
#define PIXEL_COUNT 14

Adafruit_NeoPixel strip = Adafruit_NeoPixel(PIXEL_COUNT, PIXEL_PIN, PIXEL_TYPE);

int ledPin = D7;

int pin0 = A0;
int pin1 = D1;
int pin2 = A2;
int pin3 = D3;
int pin4 = A4;
int pin5 = D5;
int pin6 = D6;

int pin0Value = 0;
int pin1Value = 0;
int pin2Value = 0; 
int pin3Value = 0;
int pin4Value = 0;
int pin5Value = 0;
int pin6Value = 0;

int instantPulseCount = 0;
int previousPulseCount = 0;
bool flowing = false;
int pulseCount = 200;
int maxPulseCount = 200; //bogus init value //real value for chad's fridge left tap: 45 pulses / qt = 900 pulses for a 5 gal keg
int percentFull = 100;
int currentSecond = 1;
int previousSecond = 0;
int animationStep = 0;
String *strArr = new String[20];

const char* pin0Name = "pin0Value";
const char* pin1Name = "pin1Value";
const char* pin2Name = "pin2Value";
const char* pin3Name = "pin3Value";
const char* pin4Name = "pin4Value";
const char* pin5Name = "pin5Value";
const char* pin6Name = "pin6Value";

int handlePost(String command);

void setup()
{
  Serial.begin(9600);
  strip.begin();
  strip.setPixelColor(0, strip.Color(0,0,255));
  strip.show();

  //get persistent values
//   pulseCount = EEPROM.read(EEPROM_ADDR_PULSE_COUNT);
//   maxPulseCount = EEPROM.read(EEPROM_ADDR_MAX_PULSE_COUNT);
//   percentFull = EEPROM.read(EEPROM_ADDR_PERCENT_FULL);

  //pin modes
  pinMode(pin0, INPUT_PULLDOWN);
  pinMode(pin1, INPUT_PULLDOWN);
  pinMode(pin2, INPUT_PULLDOWN);
  pinMode(pin3, INPUT_PULLDOWN);
  pinMode(pin4, INPUT_PULLDOWN);
  pinMode(pin5, INPUT_PULLDOWN);
  pinMode(pin6, INPUT_PULLDOWN);

  pinMode(ledPin, OUTPUT);
  
  //read any values set in the EEPROM
  maxPulseCount = EEPROM.read(EEPROM_ADDR_MAX_PULSE_COUNT);
  pulseCount = EEPROM.read(EEPROM_ADDR_PULSE_COUNT);
  percentFull = EEPROM.read(EEPROM_ADDR_PERCENT_FULL);

  //cloud variables
//   Spark.variable(pin0Name, &pin0Value, INT);
//   Spark.variable(pin1Name, &pin1Value, INT);
//   Spark.variable(pin2Name, &pin2Value, INT);
//   Spark.variable(pin3Name, &pin3Value, INT);
//   Spark.variable(pin4Name, &pin4Value, INT);
//   Spark.variable(pin5Name, &pin5Value, INT);
  Spark.variable(pin6Name, &pin6Value, INT);

  //https://api.particle.io/v1/devices/<device_id>/<variable_name>?access_token=<access_token>
  Spark.variable("maxPCount", &maxPulseCount, INT);
  Spark.variable("instPCount", &instantPulseCount, INT);
  Spark.variable("pulseCount", &pulseCount, INT);
  Spark.variable("percentFull", &percentFull, INT);

  //cloud functions - handle a cloud POST(data)
  //curl https://api.particle.io/v1/devices/<device_id>/post \
  // -d access_token=<access_token> \
  // -d "args=<command>,<data0>,<dataN>"
  Spark.function("post", handlePost);
  strip.setPixelColor(0, strip.Color(255,0,255));
  strip.show();
}

int handlePost(String postData)
{
  String* args = stringSplit(postData, ',');

  currentSecond = Time.second();
  if(currentSecond != previousSecond)
  {
      instantPulseCount = 0;
      if(previousPulseCount != pulseCount)
        flowing = true;
