Optiboot + Duemilanove problem

I finished making my USBtiny programmer and thought I’d give optiboot a try in my Duemilanove so I used my programmer and burned it into the 328.

Well I tried this little bit of code afterwards and it doesn’t function as it once did, it just flashed on and and off slowly.

I have tried it on my bog standard mega and it works fine.

Well I flashed the bootloader back to the normal version but I still can’t get the PWM to work.

Any suggestions to help me get back to where my Duemilanove was before I had the urge to fiddle would be very gratefully received.

Martyn.

/*
  Blink Fade
  Use PWM to fade LED in and out 
 */

#define DELAY 5

void setup() {                
  
  // initialize the digital pin as an output.
  // Pin 13 has an LED connected on most Arduino boards:
  pinMode(13, OUTPUT);     
}

void loop() {
int a;

  for (a=0; a<256;a++)
  {
    analogWrite(13,a);
    delay(DELAY);
  }
  for (a=254;a>-1;a--)
  {
    analogWrite(13,a);
    delay(DELAY);
  }
}

Are you saying that PWM worked on your Duemilanove on pin 13? I don't think so.

From http://www.arduino.cc/en/Reference/AnalogWrite:

For boards with an ATmega 168 or an ATmega328, analogWrite() can give PWM output on pins 3, 5, 6, 9, 10, and 11.

For For Arduino Mega boards, analogWrite() can give PWM output on pins 2 through 13.

Regards,

Dave

Ah,

This is what happens when you start out with the Mega and move down to the smaller board.

I forgot about the reduction of the PWM pins.

Thanks