Laser setup with root controller

So have my cnc all set up and working with spindle control
Does anyone have the bit of yaml code I need to write into my file to control a Laser ?

I’m sure someone must have done it Pete if your out there you have as I have seen the video

I’m sure it’s just a few lines of code ?

It’s this:

Laser:
  pwm_hz: 20000
  output_pin: gpio.33
  enable_pin: NO_PIN
  disable_with_s0: false
  s0_with_disable: true
  tool_num: 0
  speed_map: 0=0.000% 1000=100.000%
  off_on_alarm: false

Edit the pwm_hz to the maximum operating frequency of your diode laser and make sure to set the speed map to the same range as the speed map (S) in your control software like lightburn for example. So when the speed map in your config is 0-1000 it should also be 0-1000 in your laser software and not 0-255.
Edit the tool number if you are using multiple tools like a laser and a spindle.
But if you’re using a spindle with PWM control you cannot connect both at the same time, that is only possible when you use a rs485/VFD controlled spindle.

Hope this helps! There’s a bunch of information on the Root cnc Wiki and examples of config files on the Github page. Also make sure to check out the fluidnc wiki if you wanna dive a bit deeper.