Adding a laser- Issues with Marlin changes (RAMPS)

Using RAMPS, trying to add a 6w TTL laser. I understand that I need to change the D9 pin to 44, but I’m having a hard time finding the lines to change. I watched “SomeOldGuyCoding” and his video showed something different from what I’m seeing in the Arduino IDE. Perhaps someone can help?

Using “Marlin_V1CNC_Ramps_Dual_2.0.7.2_510-src” I navigate to the “Marlin.ino” file and open it in the Arduino IDE. Once there I’m not able to find the line of code to change. If I navigate farther into the Marlin folder to the “pins_RAMPS.h” file and open it with Notepad++ I can find what I believe are the proper lines and change them there. I guess I’m just wondering if this is the right place to make the changes? Will the changes be properly saved through Notepad++ and stored in the Marlin install on RAMPS, even though I didn’t edit through the Arduino IDE?

Thanks in advance!

Yeah. We have changed a few things since those videos.

That is the right file. But I believe you will need to compile it in platformio.

Try building it without changing anything first. It if build, then go ahead and make that change.

As Jeff indicates, you need to make the changes, compile the source, then upload it to your Ramps board. pins_RAMPS.h is the place to change the pin assignment. There are other changes you may want to consider. V1 enabled in-line laser support for two platforms they could test, SKR Pro and Rambo. They did not enable it for other versions including Ramps. I often find the easiest way to figure out what to change is to do a “diff” between the configuration.h and configuration_adv.h files in two versions. A free tools to compare two files is Meld. The following laser-related lines are clipped from a Meld output comparing configuration_adv.h files:

The lines in blue are the lines that are different between the two versions with Ramps on the left and Rambo on the right. I’ve clipped these lines with some context. They are not together like this in the file. You want to change the Ramps version to be like the Rambo version.

And I second Jeff’s approach:

  1. Get the firmware to compile and upload unchanged
  2. Make the pin change and upload. Verify with a multimeter that pin 44 can be changed using an M42 g-code.
  3. Make the changes in configuration_adv.h, and test with a laser. First test using the screen. You can find a test file with inline commands in the first post in this topic.

If you’re already using Notepad++, there’s a Compare plug-in that accomplishes the same as @robertbu 's Meld suggestion.