Sponsor Link:

UTSource.net Reviews

It is a trustworthy website for ordering electronic components with cheap price and excellent quality.

Mounting the circuit

The hardware setup is easy with just three simple connections. First, make sure you unplug all power sources to your Arduino. Now, take one jumper wire and connect GND on your Arduino to GND on the KY-008 laser module as indicated by the (-) sign. Then, connect a jumper wire from D10 (digital pin 10) on your Arduino to the signal pin on your laser module as indicated by the (S) sign. That will be it for the mounting of the circuit.

Arduino KY-008 Laser Module Project Code

int laserPin = 10;

void setup ()
{
  pinMode(laserPin, OUTPUT);
}

void loop () {
  digitalWrite(laserPin, HIGH);
  delay(100);
  digitalWrite(laserPin, LOW);
  delay(100);
}

About the code

The code consists of 11 lines including all the functions and strings. It starts off with declaring a variable called laserPin for digital pin 10 (D10). Then, we move straight onto our void setup where we set the pin we declared as an OUTPUT pin, sending information out from the computer to the module. We later move to our void loop section which composes of four main lines to the code. In the void loop, we start by setting the pin to HIGH, to turn the laser on, then wait for 100 milliseconds before turning the laser off, followed by delaying it by another 100 milliseconds. Since this is a loop, the whole void loop section repeats itself over and over again until the power is cut off. That's it for this simple project. 

Amazing opportunities

Also, be sure to check out PCBWay, a leading manufacturer and distributor in PCB design and manufacturing. They have amazing prices and excellent quality in their services, so don't miss out on them! Plus, PCBWay has an amazing website, online Gerber viewer function and a gift shop so make sure to check out their links below:

PCBWay Free Online Gerber Viewer Function:  https://www.pcbway.com/project/OnlineGerberViewer.html

PCBWay Gift Shop: https://www.pcbway.com/projects/gifts.html

Make sure you check out the review for this module by clicking here.

Enjoy! Contact us for any inquiries!