Ramps/MKS base 1.6 and lasers (again!..)

I’m assuming you are planning on using the fan pin and then fan g-codes to turn the laser on and off. Based on other forum posts, you will get better results by enabling the laser support in Marlin. Ryan/Jeff has enabled and tested Marlin laser support for a few boards. Ramps is not one of them, but here is a listing of the laser differences between the configuration_Adv.h files of the Ramps board and the Rambo board, which has laser support enabled.

As for the pin, it is defined in MKS_Base_common:

  //
  // M3/M4/M5 - Spindle/Laser Control
  //
  #if HAS_CUTTER
    #define SPINDLE_LASER_PWM_PIN              2  // Hardware PWM
    #define SPINDLE_LASER_ENA_PIN             15  // Pullup!
    #define SPINDLE_DIR_PIN                   19
  #endif

So you will be using pin 2 by default. This will almost certainly be a 5V pin and won’t have the issues of the fan pin.

I did not find a pinout image for the 1.6 version. Here is a link to the 1.4 pinout. The D2 pin is in the AUX 1 block. I’m not sure what the asterisks next to the pin means.

As for driving the laser, at least one person on the forum struggled with using the M3/M4/M5 g-codes, but everyone has had success using the inline commands where the laser power is specified using the ‘S’ parameter to G0 and G1 commands. You will find a test file created by Ryan in the first post of this topic.