Running a 5V 5mw 650NM laser from Arduino.

Simple as shit, but as I haven’t found it….

It’s almost the same as the “blink” example from Arduino IDE. One just needs to change the pin (I use ~11), and use analog write instead of digital.

Follows the code:

int laser = 11;

void setup() {
 pinMode(laser, OUTPUT);

// the loop function runs over and over again forever
void loop() {
 analogWrite(laser, 20); // 20:enough. 100: hurt your eyes
 analogWrite(laser, LOW);
 delay(500); // cool it down



Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s