Breathing LED, PWM - Change duration of breath


hi guys , girls,

in developing breathing lamp project of mine, i've discovered jeremy saglimbeni's breathing light code mimics fading of mac sleep light.

my comprehension of code @ stage quite modest, i'm struggling understand how change total duration of fade 2 minutes example.

the original code follows.

code: [select]
/*
"breathing sleep led, on mac.
jeremy saglimbeni 2011
thecustomgeek.com

led attached pin 11 in series 5.6k resistor
*/
int = 0;
void setup() { // bring led nicely being off
  for(i = 0 ; <= 15; i+=1)
  {
    analogwrite(11, i);
    delay(5);
  }
}
void loop()
{
  for(i = 15 ; <= 255; i+=1)
  {
    analogwrite(11, i);
    if (i > 150) {
      delay(4);
    }
    if ((i > 125) && (i < 151)) {
      delay(5);
    }
    if (( > 100) && (i < 126)) {
      delay(7);
    }
    if (( > 75) && (i < 101)) {
      delay(10);
    }
    if (( > 50) && (i < 76)) {
      delay(14);
    }
    if (( > 25) && (i < 51)) {
      delay(18);
    }
    if (( > 1) && (i < 26)) {
      delay(19);
    }
  }
  for(i = 255; >=15; i-=1)
  {
    analogwrite(11, i);
    if (i > 150) {
      delay(4);
    }
    if ((i > 125) && (i < 151)) {
      delay(5);
    }
    if (( > 100) && (i < 126)) {
      delay(7);
    }
    if (( > 75) && (i < 101)) {
      delay(10);
    }
    if (( > 50) && (i < 76)) {
      delay(14);
    }
    if (( > 25) && (i < 51)) {
      delay(18);
    }
    if (( > 1) && (i < 26)) {
      delay(19);
    }
  }
  delay(970);
}


any can shed brilliant!

thank in advance!

- daniel

what need work through step step using paper , pen.

mark


Arduino Forum > Using Arduino > Project Guidance > Breathing LED, PWM - Change duration of breath


arduino

Comments

Popular posts from this blog

opencv3, tbb and rasp pi 2 - Raspberry Pi Forums

small ethernet problem - Raspberry Pi Forums

Multithumb configuration params not working? - Joomla! Forum - community, help and support