This Keyes device is one of the more common devices found in Arduino sensor kits. Coupled with other components, it can be used to create trip wires or optical effects.The KY-008 is particularly neat because it can be directly powered from an Arduino output pin as it only draws 30 mA from the processor that has outputs rated for 40 mA.

Код программы

int laserPin = 10;
void setup ()
{
pinMode (laserPin, OUTPUT); // define the digital output interface 13 feet
}
void loop () {
laserEmiter(laserPin,15,5);
}
void laserEmiter(int laserPin,int timeToBurn,int timeToRest){//made by Ilja Kazantsev
digitalWrite (laserPin, HIGH); // Turn Laser On
delay (timeToBurn);// delay while it burns
digitalWrite (laserPin, LOW); // Turn Laser Off
delay (timeToRest);//delay till new cicle
}

void setup ()
{
pinMode (laserPin, OUTPUT); // define the digital output interface 13 feet
}
void loop () {
laserEmiter(laserPin,15,5);
}
void laserEmiter(int laserPin,int timeToBurn,int timeToRest){//made by Ilja Kazantsev
digitalWrite (laserPin, HIGH); // Turn Laser On
delay (timeToBurn);// delay while it burns
digitalWrite (laserPin, LOW); // Turn Laser Off
delay (timeToRest);//delay till new cicle
}