PWM and the Maite Pro Mini

Hi,

I am new to Arduino but not to Electronics and Micro controllers.

I am looking at using the Pro Mini to control three servos and two flickering LEDs. I have run into an issue that may be me. When I try to use PWM on Pins 10,11,12 the LED only lights when the aplitude is set to 255. The LED is connected to GND through a 220R resister.

If I move the LED Resiter to Pin 6 and change the LED_Pin1 Int to pin 6 it all works OK.

What am I missing?

Code Below:

int LED_Pin1 = 10;          // Use Pin 10 for the LED1. (Any PWM Pin will work for this.)
int howBright;             // Intensity of the LED: [0 = Off], [255 = Brightly Lit]

 //
void setup() 
{ 
    pinMode(LED_Pin1, OUTPUT);    //assigns pin 10 as output for LED1 
} 
void loop()
{
//light1
    howBright = random(128,255);          // Change brightness to something between 128 and 255
   analogWrite(LED_Pin1, howBright);       // Illuminate the LED with the brightness picked
   delay(random(0,70));                       // Makes LED seem to flicker when on for a random time 

[\Code]

Cheers Jim

I've tested that it it works on our test boards.

Can you check for dry joints.

Also what sort of bread board are you doing this on, and is the earth bar continuous?

Could you try the code below:

int LED_Pin1 = 10;          // Use Pin 10 for the LED1. (Any PWM Pin will work for this.)
int howBright;             // Intensity of the LED: [0 = Off], [255 = Brightly Lit]

 //
void setup() 
{ 
    pinMode(LED_Pin1, OUTPUT);    //assigns pin 10 as output for LED1 
} 
void loop()
{
//light1
      int x = 1;
   for (int i = 0; i > -1; i = i + x){
      analogWrite(LED_Pin1, i);
      if (i == 255) x = -1;             // switch direction at peak
      delay(10);
   } 

}

Which should cycle through from off to full on and down to off and so on.

ChilliTronix,

You are spot on! Thank you...

On close inspection the joints were not good, they did not go right through both layers of the board.

I have remade the two joints and evrything started working fine. 8-)

I have to say that I am really impressed with these boards and what they can do in such a small package!

Thanks again Jim

Many thanks... They really are good for the size and dare I say it price!

Your code produces an odd effect!