Laser diode not working - please help :(

Hi, ive been working on an iron man arm and im using 3 5mw 650nm laser diodes i wired in series. the board im using is an arduino uno r3. I wired the positive lead of the laser to pwm 6 pin on the board and negative to ground however after running the sketch everything works except the laser. when i was testing one laser on its own i got it to work with some meddling and moving the wires around but its not working now. is there any special code required or something im doing wrong. Im pretty sure i wired them in series correctly also these arnt the i2c laser diodes they are just the single cheap diodes. Please help this is the last thing ineed to fix.

this is the code for the laser:
if (b3state == HIGH) { //second button press
Lcd.clear(); //laser lcd message
Lcd.setCursor(0,0);
Lcd.print(sm6);
flap.write(pos1); //open hidden flap;servo movement
analogWrite(laser,240); //initiate laser
delay(2000);
analogWrite(laser,0);
delay(200);
analogWrite(laser,240);
delay(400);
analogWrite(laser,0);
delay(2000);
analogWrite(laser,240);
delay(1000);
analogWrite(laser,0); //end laser
flap.write(pos2); //close hidden flap;servo movement
Lcd.clear();

}
}

the servo works its just the laser diodes.
i made the analogwrite 240 to test cause iit wasnt working at 255 either.

Please use Code Tags </> to present code - see the threads on top of the forum.

In case you mean 5V laser pointer diodes, these include a current limiting resistor. For multiple diodes in series a higher supply voltage is required, with 4-6V per diode. I did not yet check whether these diode modules can be dimmed by PWM.

I expect these diodes take too much current to be supplied by an Arduino pin , and need a current limiting resistor anyhow . Running two in series probably wouldn’t work on 5v either , as said

Look at the data sheet for details

Where did you find a data sheet? We seem to talk about different diode types.

My diodes work even with a 15k resistor on a 4.5V battery. Their nominal current, without further resistors, can be supplied by Arduino outputs.

DrDiettrich:
Where did you find a data sheet? We seem to talk about different diode types.

My diodes work even with a 15k resistor on a 4.5V battery. Their nominal current, without further resistors, can be supplied by Arduino outputs.

im rather new at this so how should i go about fixing this

No fix needed if you turn a single diode per output pin on and off. What do you want to change next?

I wired the positive lead of the laser to pwm 6 pin on the board and negative to ground

This will ruin the Arduino. You need a current limiting resistor (150 Ohms minimum) in series with the diode.

You may have already burned out the pin.

It all depends on the type of the laser diodes. If they are rated 5V 20mA, as are mine, it's harmless to connect these modules directly to output pins.

Conversely, if the diode is not of your type, the pin will be burned.

Why minimize the potential problem?