Question with fade.

If I use

/*
 Fade
 
 This example shows how to fade an LED on pin 9
 using the analogWrite() function.
 
 This example based on the Arduino Example Fade sketch
 but modified to use timing instead of the delay() function
 
 */
int brightness = 0;    // how bright the LED is
int fadeAmount = 5;    // how many points to fade the LED by
unsigned long currentTime;
unsigned long loopTime;

void setup()  { 
  // declare pin 9 to be an output:
  pinMode(9, OUTPUT);
  currentTime = millis();
  loopTime = currentTime; 
} 

void loop()  { 
  currentTime = millis();
  if(currentTime >= (loopTime + 20)){  
    // set the brightness of pin 9:
    analogWrite(9, 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 ; 
    }     
    loopTime = currentTime;  // Updates loopTime
  }
  // Other processing can be done here
                           
}

my LEd only fades up to about half brightness.
But if I use

/*
 Fade
 
 This example shows how to fade an LED on pin 9
 using the analogWrite() function.
 
 This example based on the Arduino Example Fade sketch
 but modified to use timing instead of the delay() function
 
 */
int brightness = 0;    // how bright the LED is
int fadeAmount = 5;    // how many points to fade the LED by
unsigned long currentTime;
unsigned long loopTime;

void setup()  { 
  // declare pin 9 to be an output:
  pinMode(9, OUTPUT);
    Serial.begin(9600);
  currentTime = millis();
  loopTime = currentTime; 
} 

void loop()  { 
  currentTime = millis();
  if(currentTime >= (loopTime + 20)){  
    // set the brightness of pin 9:
    analogWrite(9, brightness);    

    // change the brightness for next time through the loop:
    brightness = brightness + fadeAmount;
    Serial.println(brightness);
    // reverse the direction of the fading at the ends of the fade: 
    if (brightness == 0 || brightness == 255) {
      fadeAmount = -fadeAmount ; 
    }     
    loopTime = currentTime;  // Updates loopTime
  }
  // Other processing can be done here
                           
}

add the Serial.begin(9600); to the setup and Serial.println(brightness); to the loop, I get a fade to full brightness. Why?

Because adding a Serial.print adds a delay to the loop and allows the LED to remain at the set time long enough to see it.

Increases the time between updates in the first code.

I changed it to

/*
 Fade
 
 This example shows how to fade an LED on pin 9
 using the analogWrite() function.
 
 This example based on the Arduino Example Fade sketch
 but modified to use timing instead of the delay() function
 
 */
int brightness = 0;    // how bright the LED is
int fadeAmount = 5;    // how many points to fade the LED by
unsigned long currentTime;
unsigned long loopTime;

void setup()  { 
  // declare pin 9 to be an output:
  pinMode(9, OUTPUT);
  currentTime = millis();
  loopTime = currentTime; 
} 

void loop()  { 
  currentTime = millis();
  if(currentTime >= (loopTime + 120)){  
    // set the brightness of pin 9:
    analogWrite(9, 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 ; 
    }     
    loopTime = currentTime;  // Updates loopTime
  }
  // Other processing can be done here
                           
}

and I still only get about half brightness and the fade is a long slow one...

and the fade is a long slow one.

Alter the value in the fade amount variable and
Change

if (brightness == 0 || brightness == 255)

to

if (brightness <= 0 || brightness >= 255)

changing

if(currentTime >= (loopTime + 26)){

That is an odd line anyway and will fade up slower as it gets brighter the exact opposite of what you want to do.

Still only about half the brightness of a full on led

cubmanky:
Still only about half the brightness of a full on led

So can you post a schematic of your hardware, that is showing how you have wired the LED.

I'm using a Pro Mini atmega328 and at the time I have it connected to a USB cable. Coming from pin 8 and 9 I have a LED plus resistor then feed back into the ground. I can send a command to set the lights on high and get a bright light, if I run the code for the fade it only lights up about half brightness.

That is not a schematic it OSA description and is a bit muddled. What is pin 8 got to do with anything and what value of resistor are you using.

Sorry for only giving a basic description at this time that is all I got unless you want a photo of it on the breadboard. I'm using 68 ohm resistor. Pin 8 is the connection to my Pro Mini atmega328 it is a PWM port

interesting. If I power my two LEDS from the USB cable the fadeing led is dim and the strob LED is bright. If I unhook USB and add 4.8v power then the light is bright.

A 68R resistor is too low you will. Urn the arduino output. You still have not explained what the two pins are doing.
Draw a schematic please.