SOLVED: LED fading question - fade up/dwn and hold function?

Hi, I am new here and very new to using the Arduino UNO. After downloading the software I was able to find my way around the tool bar.

The first program I loaded into the UNO was the Fade and Fading programs. They each worked the first time :)

I've been trying to figure out how to increase the (off) time between after the LED fades off and it begins to increase in intensity? It begins to start getting brighter right as soon as it fades completely. And also increasing the ON time as well (before it begins to fade again). I guess I need it to hold in each of these states longer while not effecting the speed of the fade.....

I'm just not figuring this out by looking at others codes :(

If you can help, I would be very appreciative.

Thank you for your time and knowledge.

(deleted)

(deleted)

spycatcher2k: OK - First of all, can you post the code you are referring to, then we may be able to help.

Sorry about that. I don't know how to put the code into an code box.

I'm looking to add a longer delay while it's off and while it's on, without effecting the speed of the change...

Also, I may have posted this in the wrong spot....

/* Fade

This example shows how to fade an LED on pin 9 using the analogWrite() function.

This example code is in the public domain. */

int led = 9; // the pin that the LED is attached to int brightness = 0; // how bright the LED is int fadeAmount = 5; // how many points to fade the LED by

// the setup routine runs once when you press reset: void setup() { // declare pin 9 to be an output: pinMode(led, OUTPUT); }

// the loop routine runs over and over again forever: void loop() { // set the brightness of pin 9: analogWrite(led, brightness);

// change the brightness for next time through the loop: brightness = brightness + fadeAmount;

// reverse the direction of the fading at the ends of the fade: if (brightness == 0 || brightness == 255) { fadeAmount = -fadeAmount ; } // wait for 30 milliseconds to see the dimming effect delay(30); }

(deleted)

WOW! That is exactly what I needed..

Thanks spycatcher2k so much for the quick response!

Did you give him a "karma point"? In forum is the way to say "thanks". Use the "code" tag to make your code more legible. You have a button with a "#" that creates to tags to put the code inside.

Personal Message (Online)
/*
 Fade

 This example shows how to fade an LED on pin 9
 using the analogWrite() function.

 This example code is in the public domain.
 */

int led = 9;           // the pin that the LED is attached to
int brightness = 0;    // how bright the LED is
int fadeAmount = 5;    // how many points to fade the LED by

// the setup routine runs once when you press reset:
void setup() {
  // declare pin 9 to be an output:
  pinMode(led, OUTPUT);
}

// the loop routine runs over and over again forever:
void loop() {
  // set the brightness of pin 9:
  analogWrite(led, brightness);

  // change the brightness for next time through the loop:
  brightness = brightness + fadeAmount;

  // reverse the direction of the fading at the ends of the fade:
 if (brightness == 0 || brightness == 255) {
    fadeAmount = -fadeAmount ;
delay(1000);
  }
  // wait for 30 milliseconds to see the dimming effect
  delay(30);
}

Hi luisilva, I didn't know about the "code" tag. I still don't know how to give karma points or I would for the information I was looking for today :)

Thanks

For example in the post of “spycatcher2k”, in the left side you have:
Nick name
Location
online/offline
Status in the forum
Karma:
“+” number
number of posts
etc.

If you click at the “+” you will see the karma points increasing.