Creating a GPIO Macro to run a DC Motor
-
Re: Creating a timed fan Marco and Meta
Hi,
Following on this topic, I've got a similar large format Cartesian printer with a 6HC main board and 3HC expansion boards which I've equipped with a small (M5Stack) dc motor to periodically vibrate for a second to make sure pellets are not binding in the feed passage.
I've got the DC motor connected to the IO_1 of my 3rd 3HC and it runs (constantly, I know this is on 100%, this is just for testing) with this in my config.g -
; Pellet Shaker M950 P1 C"3.io1.out" Q450 ; create output/servo M42 P1 S1 ; set 100% PWM on GPIO port 1
What I thought I could do is modify the code that @infiniteloop and @OwenD helped @kmoore for his pellet feed-
; filamentmonitor.g ; Check filament progress, feed pellets if needed if job.file.fileName == null M99 if {{global.filamentProgress + 11500.0} <= move.extruders[0].position} ; set global.filamentProgress = {move.extruders[0].position + 11500.0} M106 P0 S255 G4 S3 M106 P0 S0
But in my case, I'd like to switch on a fan connection on the 6HC using the M106 command and pulse the pellets a bit.
Is there a way of adding control over the DC motor connected to the IO_1 pins within that macro?
Thanks very much, Nate
-
You need to use M42
https://docs.duet3d.com/User_manual/Reference/Gcodes#m42-switch-io-pin -
@OwenD Thanks, that can be run like the M106 command in the macro?
-
@madeinta1wan said in Creating a GPIO Macro to run a DC Motor:
@OwenD Thanks, that can be run like the M106 command in the macro?
Yes
if {{global.filamentProgress + 11500.0} <= move.extruders[0].position} ; set global.filamentProgress = {move.extruders[0].position + 11500.0} M106 P0 S255 M42 P1 S1 G4 S3 M106 P0 S0 M42 P1 S0
-
@OwenD Amazing thanks very much