See in Driver.cpp
void LaserDriver::changeIntensity(secondspeed_t newIntensity)
{
#if defined(DOOR_PIN) && DOOR_PIN > -1
if(Printer::isDoorOpen()) {
newIntensity = 0; // force laser off if door is open
}
#endif
if(EVENT_SET_LASER(newIntensity))
{
// Default implementation
#if LASER_PIN > -1
WRITE(LASER_PIN,(LASER_ON_HIGH ? newIntensity > 199 : newIntensity < 200));
#endif
}
intens=newIntensity;//for "Transfer" Status Page
}You see our code only sets it on/off but it offers a solution by implementing EVENT_SET_LASER to set the intensity using a hardware pwm or send intensity vie I2C just like you need it. Forum has already some implementation if you search it.
D9 Is for 12V full power. Sure this is the right pin to connect? Many lasers have a 5V TTL line to trigger on/off and use permanent 12V to e.g. also show a help light, power electronics...