I used this setup with a HW-493, and and external 5V power supply. The ground was connected, on my UNO R3.
Running a slight variation on Blink.ino :
int laser = 2;
void setup() {
// initialize digital pin laser as an output.
pinMode(laser, OUTPUT);
}
void loop() {
digitalWrite(laser, HIGH); // turn the laser on (HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(laser, LOW); // turn the laser off by making the voltage LOW
delay(1000); // wait for a second
}
I think I fried pin 2 (and 3, which I also tried it on), but I'm asking here to
Unlikely if there was a 22k resistor between the base of the transistor and your output pin, and all GNDs were indeed connected.
If the 'Laser' is a bare laser diode, it is likely you fried that. And/or the transistor.
Can you tell us a little more about what the 'Laser' is and which transistor you used, and show a picture of the circuit as built? Preferably also a schematic of the entire system, not just the few components around the 'Laser'.
This is the entire circuit pretty much.
" The device includes a built-in 91 ohm current limiting resistor and draws about 30mA. ", some specs I found for this diode.
UPDATE: It seems they are not fried. I was not running the code I thought I was, but the project I was working on. There, pin 2 & 3 were assigned to servos, which caused the problem
Handy hint,
If you add the following to setup( ), then it will print out on the serial monitor the name of the file that you are using, and the date and time it was compiled: