//Kevin Rye - 2016
//compiled on Arduino 1.6.7
//Talking Clock play button PWM for ATtiny85
//This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.
//http://creativecommons.org/licenses/by-nc-sa/4.0/deed.en_US
//Breathing LED code inspired by Jeremy Saglimbeni from thecustomgeek.com, 2011

const int blue = 0;

int i = 0;

void setup() {

  pinMode(blue, OUTPUT);

}

void loop() {

  //up
  for (i = 10 ; i <= 255; i += 1)
  {
    analogWrite(blue, i);
    if (i > 150) {
      delay(4);
    }
    if ((i > 125) && (i < 151)) {
      delay(5);
    }
    if (( i > 100) && (i < 126)) {
      delay(7);
    }
    if (( i > 75) && (i < 101)) {
      delay(10);
    }
    if (( i > 50) && (i < 76)) {
      delay(14);
    }
    if (( i > 25) && (i < 51)) {
      delay(18);
    }
    if (( i > 1) && (i < 26)) {
      delay(19);
    }
  }

  // down
  for (i = 255; i >= 10; i -= 1)
  {
    analogWrite(blue, i);
    if (i > 150) {
      delay(4);
    }
    if ((i > 125) && (i < 151)) {
      delay(5);
    }
    if (( i > 100) && (i < 126)) {
      delay(7);
    }
    if (( i > 75) && (i < 101)) {
      delay(10);
    }
    if (( i > 50) && (i < 76)) {
      delay(14);
    }
    if (( i > 25) && (i < 51)) {
      delay(18);
    }
    if (( i > 1) && (i < 26)) {
      delay(19);
    }
  }
  delay(1000);

}

