R. Scott Coppersmith
Published © MIT

Snapmaker Original 10W Laser Upgrade

The Snapmaker 3-in-1 original 3D printer/Laser Engraver/CNC machine is a useful tool. The laser engraver, however, is weak.

IntermediateFull instructions provided10 hours291
Snapmaker Original 10W Laser Upgrade

Things used in this project

Hardware components

Snapmaker - Original
×1
10w laser
×1

Story

Read more

Code

Arduino code to read an analog input and PWM an output to vary the output of the laser module

Arduino
Arduino code to read an analog input and PWM an output to vary the output of the laser module
int sensorPin = A0;    // select the input pin for the potentiometer
int ledPin = 13;      // select the pin for the LED
int sensorValue = 0;  // variable to store the value coming from the sensor
int brightness = 0;    // how bright the LED is
int fadeAmount = 5;    // how many points to fade the LED by
int outpin = 2;
void setup() {
    // initialize serial communication at 9600 bits per second:
  Serial.begin(9600);
  // declare the ledPin as an OUTPUT:
  pinMode(ledPin, OUTPUT);
  pinMode(outpin, OUTPUT);
}

void loop() {
  // read the value from the sensor:
  sensorValue = analogRead(sensorPin)/3;
  Serial.println(sensorValue);
  analogWrite(ledPin, brightness);
  analogWrite(outpin, brightness);
   // change the brightness for next time through the loop:
  brightness =  sensorValue;
  // wait for 30 milliseconds to see the dimming effect
  delay(30);
}

Credits

R. Scott Coppersmith
17 projects • 25 followers
Research Engineer, Embedded systems designer
Contact

Comments

Please log in or sign up to comment.