3 Simple Ways to
Share What You Make

With Instructables you can share what you make with the world — and tap into an ever-growing community of creative experts.

PhotosPhotos

Share one or more photos of a project, recipe, or whatever you've made, quickly and easily.

Step by StepStep-By-Step

Share your step-by-step photos with text instructions of what you made so others can do it too!

VideoVideo

Share your how-to video. You'll need your embed code from a video site such as YouTube.

Test your radar detector or laser jammer with this traffic enforcement LIDAR gun simulator

Step 5Arduino Code

Arduino Code
#include

LiquidCrystal lcd(8,7,6,5,4,2); // setup LCD 4 bit mode
int pulse=1; // pulse size length in microseconds
int choice;  // select laser gun model type
int lastchoice=0; // recall last selection choice
int fire; // trigger fire button

void setup() {
  lcd.begin(16,2);    // 16x2 LCD
  analogWrite(10,90); // foreground LCD
  analogWrite(9,150); // background LCD ~3.3 volts
  lcd.clear();
  pinMode(13, OUTPUT);  // 940nM LED output (mimic 904nM laser diode)
  pinMode(11, INPUT);   // setup trigger button as input
}

void loop() {
  choice=analogRead(0);  // read laser gun model selection from 10K pot
  choice=(int)(choice/85.25);  // only 12 valid choices, 11 guns + stealth mode

  if (choice != lastchoice) // clear display only if it's different
    lcd.clear();
  lastchoice=choice;

  switch (choice) {
  case 0:
    lcd.setCursor(0, 0);
    lcd.print("Ultralyte Non-LR"); // 100 pulses per second
    fire=digitalRead(11);
    if (fire==0) {
      lcd.setCursor(0, 1);
      lcd.print("Fire");
      for (int a=1; a<=3; a++) {
        digitalWrite(13, HIGH);
        delayMicroseconds(pulse);
        digitalWrite(13, LOW);
        delayMicroseconds(9999); // 10ms
      }
      lcd.setCursor(0, 1);
      lcd.print("    ");
    }
    break;
  case 1:
    lcd.setCursor(0, 0);
    lcd.print("Ultralyte Rev.1"); // 100pps
    fire=digitalRead(11);
    if (fire==0) {
      lcd.setCursor(0, 1);
      lcd.print("Fire");
      for (int a=1; a<=3; a++) {
        digitalWrite(13, HIGH);
        delayMicroseconds(pulse);
        digitalWrite(13, LOW);
        delayMicroseconds(9999); // 10ms
      }
      lcd.setCursor(0, 1);
      lcd.print("    ");
    }
    break;
  case 2:
    lcd.setCursor(0, 0);
    lcd.print("Jenoptik LaserPL"); // 100pps
    fire=digitalRead(11);
    if (fire==0) {
      lcd.setCursor(0, 1);
      lcd.print("Fire");
      for (int a=1; a<=3; a++) {
        digitalWrite(13, HIGH);
        delayMicroseconds(pulse);
        digitalWrite(13, LOW);
        delayMicroseconds(9999); // 10ms
      }
      lcd.setCursor(0, 1);
      lcd.print("    ");
    }
    break; 
  case 3:
    lcd.setCursor(0, 0);
    lcd.print("Kustom Prolaser3"); // 200 pps
    fire=digitalRead(11);
    if (fire==0) {
      lcd.setCursor(0, 1);
      lcd.print("Fire");
      for (int a=1; a<=3; a++) {
        digitalWrite(13, HIGH);
        delayMicroseconds(pulse);
        digitalWrite(13, LOW);
        delayMicroseconds(4999); // 5ms
      }
      lcd.setCursor(0, 1);
      lcd.print("    ");
    }
    break;
  case 4:
    lcd.setCursor(0, 0);
    lcd.print("Jenoptik Laveg"); // 600pps
    fire=digitalRead(11);
    if (fire==0) {
      lcd.setCursor(0, 1);
      lcd.print("Fire");   
      for (int a=1; a<=3; a++) {
        digitalWrite(13, HIGH);
        delayMicroseconds(pulse);
        digitalWrite(13, LOW);
        delayMicroseconds(1666);
      }
      lcd.setCursor(0, 1);
      lcd.print("    ");
    }
    break;
  case 5:
    lcd.setCursor(0, 0);
    lcd.print("Kustom Prolaser1"); // 380pps
    fire=digitalRead(11);
    if (fire==0) {
      lcd.setCursor(0, 1);
      lcd.print("Fire");   
      for (int a=1; a<=3; a++) {
        digitalWrite(13, HIGH);
        delayMicroseconds(pulse);
        digitalWrite(13, LOW);
        delayMicroseconds(2631);
      }
      lcd.setCursor(0, 1);
      lcd.print("    ");
    }
    break;
  case 6:
    lcd.setCursor(0, 0);
    lcd.print("Ultralyte Rev.2"); // 125 pps
    fire=digitalRead(11);
    if (fire==0) {
      lcd.setCursor(0, 1);
      lcd.print("Fire");   
      for (int a=1; a<=3; a++) {
        digitalWrite(13, HIGH);
        delayMicroseconds(pulse);
        digitalWrite(13, LOW);
        delayMicroseconds(8000);
      }
      lcd.setCursor(0, 1);
      lcd.print("    ");
    }
    break;
  case 7:
    lcd.setCursor(0, 0);
    lcd.print("Stalker LZ-1"); // 130pps
    fire=digitalRead(11);
    if (fire==0) {
      lcd.setCursor(0, 1);
      lcd.print("Fire");   
      for (int a=1; a<=3; a++) { 
        digitalWrite(13, HIGH);
        delayMicroseconds(pulse);
        digitalWrite(13, LOW);
        delayMicroseconds(7691);
      }
      lcd.setCursor(0, 1);
      lcd.print("    ");
    }
    break;
  case 8:
    lcd.setCursor(0, 0);
    lcd.print("Kustom Prolaser2"); // 238pps
    fire=digitalRead(11);
    if (fire==0) {
      lcd.setCursor(0, 1);
      lcd.print("Fire");   
      for (int a=1; a<=3; a++) {
        digitalWrite(13, HIGH);
        delayMicroseconds(pulse);
        digitalWrite(13, LOW);
        delayMicroseconds(4201);
      }
      lcd.setCursor(0, 1);
      lcd.print("    ");
    }
    break;
  case 9:
    lcd.setCursor(0, 0);
    lcd.print("Laser Atlanta"); // 238pps
    fire=digitalRead(11);
    if (fire==0) {
      lcd.setCursor(0, 1);
      lcd.print("Fire");   
      for (int a=1; a<=3; a++) {
        digitalWrite(13, HIGH);
        delayMicroseconds(pulse);
        digitalWrite(13, LOW);
        delayMicroseconds(4201);
      }
      lcd.setCursor(0, 1);
      lcd.print("    ");
    }
    break;
  case 10:
    lcd.setCursor(0, 0);
    lcd.print("Laser Atlanta"); // 238pps stealth mode
    lcd.setCursor(0,1);
    lcd.print("Stealth Mode");    // 2 pulses fire followed by 5 missing pulses
    fire=digitalRead(11);
    if (fire==0) {
      lcd.setCursor(12,1);
      lcd.print("Fire");   
      for (int a=1; a<=2; a++) {
        digitalWrite(13, HIGH);
        delayMicroseconds(pulse);
        digitalWrite(13, LOW);
        delayMicroseconds(4201);
        digitalWrite(13, HIGH);
        delayMicroseconds(pulse);
        digitalWrite(13, LOW);
        delayMicroseconds(12603);  // need 6 delays units (4201*3)
        delayMicroseconds(12603);  // (4201*3)
      }
      lcd.setCursor(12,1);
      lcd.print("    ");
    }
    break;
  case 11:
    lcd.setCursor(0, 0);
    lcd.print("Kustom ProLite"); // 200 pps
    fire=digitalRead(11);
    if (fire==0) {
      lcd.setCursor(0, 1);
      lcd.print("Fire");
      for (int a=1; a<=3; a++) {
        digitalWrite(13, HIGH);
        delayMicroseconds(pulse);
        digitalWrite(13, LOW);
        delayMicroseconds(4999); // 5ms
      }
      lcd.setCursor(0, 1);
      lcd.print("    ");
    }
    break;
  }
}
« Previous StepDownload PDFView All StepsNext Step »

Pro

Get More Out of Instructables

Already have an Account?

close

All Steps Viewing
View all steps of an Instructable on the same page when you're a Pro Member.

Upgrade to Pro today!
3
Followers
1
Author:BlackLight99