Rambo 1.4 5V logic

Do I have do an M42 in every gcode file I use or do you set it once and I’m good to go unless I reset your board?

The M42 will need to go in every file, but it can be inserted automatically. Most CAM apps as well as most g-code sending apps have something like “start code” and “end code” sections where you can put g-code you want to inserted at the beginning and end of your file. You setup these sections once, and all the files generated after that will have the your M42 in them. What tools are you using in your authoring pipeline?

Edit: You question hints that maybe I was not clear. At the top of each file you may have to set the pin for output and you turn it on:

M42 P46  M1    ; Set pin for output. May or may not be needed.
M42 P46  S255  ; Turn pin 46 on

Then at the bottom of the tile:

M42 P46 S0    ; Turn pin off

According to the reference, the following can be used to turn on a non-PWM pin (will probably work for a PWM pin as well). Pin 46 is a PWM pin.

M42 P46 S1     ; Turn on a non-PWM pin

And reiterating, your CAM or g-code sending apps can include these codes automatically.

For now I’m using Estlcam and RepetierHost.

I’m thinking of reassigning a one of the pins as a fan pin and reflash the board and then use a fan on/off command. I’d rather not have to use M42 everywhere I need to turn the spindle on/off like at the beginning and end but especially for tool change.

Rather than changing pins, try turn laser mode off in the firmware. Laser mode is toggling the enable pin assuming you don’t want it cutting during travel moves.

1 Like

If you want to go the route suggested by Tom, I believe commenting out this line in configuration_adv.h will do the job.

#define LASER_FEATURE

Thank you. Both of you.

Since I intend to also be able to do laser engraving with my machine I decided against touching the laser pins. Instead I reassigned one of the fans to pin 46 and reflashed the board. Can now use commands M106/M107. Seems to work… so far.

#ifndef FAN_PIN

#define FAN_PIN 46

#endif

2 Likes

That makes sense for a machine where you’re going to switch between tools like that. I’m running grbl on by Burly, so if I ever get around to mounting a laser on it I’ll be able to toggle $32 without having to reflash firmware.