How to Control a Servo Using GRBL

58,765

296

43

About: 55+ years in electronics, computers, and teaching ... now retired.

GRBL is an arduino program for controlling each of the XYZ stepping motors on 3-axis machines such as 3D-printers and milling machines. [1]

If you study the predefined GRBL pin-outs in photo 2 you will see that none of the PWM (pulse width modulation) pins are available for controlling a servo.

This instructable explains how to:

  • free up a PWM servo pin by modifying GRBLversion 1.1f,
  • configure GRBL for coreXY plotters,
  • create a g-code calibration file using Inkscape 0.92,
  • insert the necessary pen-lift control codes using “GcodePostProcessor” [2],
  • configure your plotter settings and
  • send the modified g-code to your plotter.

The opening photo shows the results obtained when I ported GRBL to the CoreXY plotter described in https://www.instructables.com/id/CoreXY-CNC-Plott...

The video shows GRBL controlling a servo motor using the pen-lift code sequences generated by “GcodePostProcessor”. The solid blue line indicates when the servo arm should be up as the virtual pen traverses the letters ABC.

[1]

More information may be found at https://github.com/gnea/grbl/wiki

[2]

“GcodePostProcessor (GPP)” inserts GRBL servo pen-lift commands into existing g-code. This original program, and the source code, are attached to this instructable.

Step 1: Theory

Servo motors require pulse width modulation (PWM) signal to operate. Unfortunately GRBL has allocated another task to each of the PWM pins ... we need to borrow one of these pins to control our servo.

Pin 11 is an ideal candidate as the “Limit Z-Axis” function is not required when plotting ... but to access this pin we must replace the “spindle_control.c” code module within GRBL with code of our own.

This solves one problem but creates another ... any G-code that we send to the plotter now requires “special” code sequences for raising and lowering the pen.

Generating the Code Sequences

There are two distinctly different ways of doing this:

  1. add an “extension” to Inkscape. [1]
  2. insert the required M3,M5 code sequences into existing G-code using a post-processor.

The end result from both approaches is the same.

An example of post-processing using my “GcodePostProcessor” is shown in photo 1. The left-hand file contains the original Inkscape g-code. The right-hand file contains the additional GRBL command sequences. Lines that have been deleted are shown with a red “minus” sign and red highlight. Lines that have been added are shown with a green “plus” sign and green highlight.

Let’s get started ...

[1]

A video demonstrating this process may be found at https://www.youtube.com/watch?v=k1vzT-T8LJA and is fully documented in the comment section below the video.

A downside to this approach is that the extension may become obsolete. For example the “MI Inkscape Extension” used in the above video only works with Inkscape 0.47.

[2]

A post-processor offers the following advantages:

  • existing G-code files don’t have to be recreated.
  • it works with any G-code software generator.
  • it is compatible with the latest versions of Inkscape.

Step 2: Hardware and Software Requirements

Before starting we need to organize our hardware and software.

Hardware

Your plotter wiring should match that shown in the photo “GRBL Servo Wiring” .

All components in the attached parts list were obtained from https://www.aliexpress.com/

Instructions for adjusting the motor currents are contained in the parts list.

Software

The following software should be be installed on your computer:

[1]

Java 8 is required by “Processing 3” and “Universal Gcode Sender”

[2]

“Processing 3” is a graphics processor with an interface similar to the Arduino IDE (integrated development environment). Apart from a few extra drawing commands the two programs are similar except that Processing 3 calls its main loop draw(){}.

Step 3: Modifying GRBL

The following steps are required:

  1. Download and unzip “grbl-1.1f.20170131.zip” (photo 1) from https://github.com/gnea/grbl/releases
  2. Download “spindle_control.c” (photo 2) from http://www.buildlog.net/blog/2017/08/using-grbls-... . [1] [2]
  3. Navigate to the “grbl” folder within the zip file we have downloaded and replace the “spindle._control.c” file with the “spindle_control.c” file from “www.buildlog.net”.
  4. If you have a COREXY plotter you must edit line 189 in the file “config.h” to read “#define COREXY;” as shown in photo3. Use a text editor such as Notepad++ to do this. Do NOT use a word processor.
  5. Copy the “grbl folder” to the arduino “libraries” folder and rename to say “grbl1.1f_servo” ... the name doesn’t matter so long as you can find the folder. The path to this folder is normally C:\Documents\Arduino\libraries\.
  6. Open your arduino IDE and navigate to the folder C:\Documents\Arduino\libraries\grbl1.1f_servo\examples\grblUpload.
  7. Select the sketch “grblUpload.ino” then upload it to your arduino.

That’s it ... GRBL is installed.

[1]

This blog fully explains the process. For convenience, a copy of this “spindle_control.c” file is attached to this instructable in case, as happened to me, some of the comments and source code get merged during download and need to be unscrambled.

[2]

19 January 2019

The file "spindle_control.c" has been removed from http://www.buildlog.net/blog/2017/08/using-grbls-...

For convenience a version of GRBL that contains an updated version of "spindle_control.c" may be obtained by downloading "Grbl_Pen_Servo-master.zip" from https://github.com/bdring/Grbl_Pen_Servo and following the authors installation instructions.

If you compare the the header in the original "spindle_control.c" (attached to this instructable) with that in this latest version you will note a major change.

The original version of "spindle_control.c" reads: "When the spindle is on, the servo moves the pen down. When it is off the pen moves up".

The latest version of "spindle_control.c" reads: "In stepper.c it will will look at the Z position. Any Z>0 is pen up." which means that post-processing is no longer required.

In this new release, "Grbl is still running a full range virtual Z axis with accelerations and speeds. Be aware how this will affect your pen. For example: If the Z is at 5 and you tell it to go to -5, the pen will stay up as the virtual z moves from 5 to 0. The pen will then go down. The virtual Z will continue to go down to -5 before it executes the next move. You can control these "delays" by adjusting the speed and acceleration of the Z axis and what your CAM uses a Z locations for up and down.

If you want to have the pen go to the up position at turn on, define a negative Z work offset. Send the command "G10 L2 P0 Z-2". This will trick Grbl into thinking the pen needs to be up."

Step 4: Create Some G-code

It is helpful to have a calibration file for checking the accuracy of your plotter.

Let’s generate the g-code for a 100mm square using the latest version of Inkscape [1], then insert the required GBRL servo commands using “GcodePostProcessor”.

Create a “square” using Inkscape

The following steps are required:

  1. Launch Inkscape
  2. Click "File|Document properties" (Shift+Ctrl+D)and set your paper size.
  3. Click "Create Rectangles & Squares" (F4) from the sidebar.
  4. Click and drag a rough square shape. (photo 1)
  5. Click "Select and transform objects" (F1) from the sidebar. Our square will become surrounded by tiny arrows. (photo 2). At this point we could simply drag this shape onto our work area, but let's add some accurate dimensions so that we can check our plotter calibration.
  6. Change the (W)idth and (H)eight measurements to 100mm then click the padlock. (photo 3)
  7. Now drag the square onto the work area. Set the X & Y positional values to whole numbers. (photo 4)

We are now ready to create our G-code.

Generate the G-code

The following steps are required:

  1. Click "Path|Object to path" ... nothing appears to happen but it does.
  2. Click "Extensions|Gcodetools|Orientation points|Apply ... then Close" ... orientation points will appear. (photo 5)
  3. Click the square to bring back the arrows.
  4. Click "Extensions|Gcodetools|Tools library|Default ... then Close" ... a green screen will appear. (photo 6)
  5. Click the "Create and edit text objects" (F8) from the sidebar.
  6. Carefully edit the speeds in the green box. I've set my plotter speeds to 10000mm per minute in this example. (photo 7)
  7. Click and drag the green box to one side of our work space.
  8. Click our square to select it.
  9. Click "Extensions|Gcodetools|Path to Gcode|Preferences" and complete the form. (photo 8)
  10. Click "Options" and make any changes. For test purposes I have increased the arc radius to 1mm ... the default value is 0.02mm (photo 9)
  11. Click "Path to Gcode". (photo 10)
  12. Click "Apply" and a toolpath with tiny direction arrows will eventually appear. (photo 11)
  13. You may now close Inkscape ... a file "square.gcode" should appear on your desktop. The contents of this file are shown in photo 12.

If you examine the code in photo 12 you will see that Inkscape has inserted some M2,M3,M5 codes.

These codes are for a milling machine, not a plotter, and need to be stripped out and replaced with custom codes of our own.

Let's do this ...

Step 5: Insert the Pen-Lift Commands

This step explains how to:

  1. install, and run, “GcodePostProcessor” [1].
  2. create a standalone executable version of “GcodePostProcessor.exe”.

Install the Post Processor

The next three steps only have to be done once:

  1. launch Processing 3
  2. copy the contents of “GcodePostProcessor.pde” (attached) into the Processing 3 sketch.
  3. save the sketch as “GcodePostProcessor” without the quotes. This will create a folder C:\Documents\Processing\GcodePostProcessor.

Run the Post Processor

The following steps are required for every plotter file:

  1. open the “GcodePostProcessor” sketch (photo 1)
  2. copy “square.gcode” from your desktop to folder C:\Documents\Processing\ GcodePostProcessor
  3. click the Processing “Run” button (top-left arrow-head) ... a series of popup boxes will appear (photos 2..5)
  4. click the the first pop-up box and type the filename (in this case “square.gcode”).
  5. A file, “square.gcode.gcode”, will appear in your C:\Documents\Processing\GcodePostProcessor folder. [2]

We will send this file to our plotter shortly.

Create an Executable Version of the Post Processor

This (optional) once-only step creates an executable version of “GcodePostProcessor.exe”

The following steps are required:

  1. open the “GcodePostProcessor” sketch.
  2. click File|Export Application ... |
  3. complete the pop-up box (photo 6)
  4. click Export ... an application.windows64 folder will appear in C:\Documents\Processing\insertGcode (photo 7)
  5. copy/move this application.windows64 folder to your desktop and rename it “Post Processor”. (photo 8)
  6. copy “square.gcode” file to this folder
  7. double-click “GcodePostProcessor.exe” and follow the prompts ... the program works as before.

[1]

My “GcodePostProcessor” algorithm:

  • strips out the M2 code at the end of the program. This prevents the pen marking the paper when the plot is complete.
  • strips out all M3, M5 codes to avoid unwanted pen-lift conflicts
  • inserts an M3, or M5 code, sequence whenever the g-code changes from G0 to any of the G1,G2,G3 commands, and vice versa. When plotting, the pen is always down unless a G0 command is received.

[2]

“GcodePostProcessor” adds a “.gcode” extension to your original filename which:

  • groups the source and plotter files together
  • clearly identifies which of the two files is the plotter file (the filename is longer)
  • makes your plotter file easier to find when using the UGS file browser (otherwise you have to select “all files”).

Step 6: Configure Your Plotter

GRBL comes with a number of default plotter settings. In most cases these setting are not what we want and need to be edited prior to plotting. This is a once-only process.

There are two ways we can do this:

  1. edit the GRBL settings using the arduino “Serial Monitor”.
  2. use the command line in “Universal code Sender”.

Both methods are similar ... let’s use the command line in “Universal Gcode Sender” as that requires less cable swapping:

Connect your plotter

To do this:

  1. Plug the arduino USB cable into your computer
  2. launch “Universal Gcode Sender”
  3. select your COM port
  4. set the communications speed to 115200 bauds
  5. click “Open” ... a list of plotter settings will appear [1]

Change your plotter settings

The settings for your plotter are stored in non-volatile memory which means they only need to be configured once. [1]

The default settings in GRBL are shown below:

  • $0=10 Step pulse, microseconds
  • $1=25 Step idle delay, milliseconds
  • $2=0 Step port invert, mask
  • $3=0 Direction port invert, mask
  • $4=0 Step enable invert, boolean
  • $5=0 Limit pins invert, boolean
  • $6=0 Probe pin invert, boolean
  • $10=1 Status report, mask
  • $11=0.010 Junction deviation, mm
  • $12=0.002 Arc tolerance, mm
  • $13=0 Report inches, boolean
  • $20=0 Soft limits, boolean
  • $21=0 Hard limits, boolean
  • $22=1 Homing cycle, boolean
  • $23=0 Homing dir invert, mask
  • $24=25.000 Homing feed, mm/min
  • $25=500.000 Homing seek, mm/min
  • $26=250 Homing debounce, milliseconds
  • $27=1.000 Homing pull-off, mm
  • $30=1000. Max spindle speed, RPM
  • $31=0. Min spindle speed, RPM
  • $32=0 Laser mode, boolean
  • $100=250.000 X steps/mm
  • $101=250.000 Y steps/mm
  • $102=250.000 Z steps/mm
  • $110=500.000 X Max rate, mm/min
  • $111=500.000 Y Max rate, mm/min
  • $112=500.000 Z Max rate, mm/min
  • $120=10.000 X Acceleration, mm/sec^2
  • $121=10.000 Y Acceleration, mm/sec^2
  • $122=10.000 Z Acceleration, mm/sec^2
  • $130=200.000 X Max travel, mm
  • $131=200.000 Y Max travel, mm
  • $132=200.000 Z Max travel, mm

To change any setting simply type the setting number followed by “=” then the “value” into the command line. Once you have finished type $$ to confirm the settings. For example $100=80 tells GRBL that your plotter requires 80 steps to travel 1 mm.

The $100..$132 settings shown in photo 1 are for the CoreXY plotter described in described in https://www.instructables.com/id/CoreXY-CNC-Plott... [2]

[1]

The setting descriptions have been dropped from the latest version of GRBL as the program requires as much memory as possible. Each setting, however, is fully documented in https://github.com/gnea/grbl/wiki/Grbl-v1.1-Config...

Thoughtfully, UGS (Universal Gcode Sender) displays this information alongside each setting.

[2]

Caveat Emptor ... I’m not an expert.

All of my settings were found by trial and error apart from the 80 steps/mm for $100, $101, and $102, which were calculated.

To ensure that GRBL has full control of the XYZ speed settings I set the F(feed value) in the Inkscape’s “Default Tool” menu to a value higher than the $110, $111, and $112 values in GRBL on the basis that the lowest speed wins ... this approach appears to work.

Must experiment further ...

Step 7: Plotting

Positioning your pen

Without limit switches, your arduino thinks that the pen is resting at Inkscap coordinate (0,0) when power is applied. I must be doing something wrong because this rarely happens.

The following neat trick solves two startup problems in a single operation:

  1. remove the pen.
  2. plot something small, such as our square.
  3. the GRBL (0,0) coordinate is wherever the pen stops
  4. GodePostProcessor leaves your pen pointing upwards ............................ (problem 1 solved)
  5. switch off the power to the motors.
  6. reattach the pen and move it to your Inkscape (0,0) coordinate .............. ..(problem 2 solved)
  7. switch the power back on to the motors.

You can plot all day now ... the plotter will always return to this coordinate :)

6 March 2018

Finally, with a little help, I have solved the pen positioning problem:

  1. run UGS and "open" a connection to your arduino.
  2. from the command line type "M3 S90" to raise the pen
  3. (comment: the command "M5" lowers the pen)
  4. "check" the box labelled "Enable Keyboard Movement" (photo 1)
  5. set the "XY step size" to 10 mm
  6. set the "Feed rate" to 1000 mm/minute
  7. click the +X, -X, +Y, -Y buttons to move the pen.
  8. when the pen is in the correct position click the "Reset Zero" button
  9. uncheck the "Enable Keyboard Movement" box

The plotter will now return to this position.

Plotting an image

Using photo 2 as a reference:

  1. launch “Universal Gcode Sender”
  2. enter the COM port attached to your plotter
  3. set the communication speed to 115200 bauds
  4. browse for a modified g-code file.
  5. click “Visualize” and a screen will (eventually) appear. The solid blue path indicates when your pen will be up.
  6. click “Open” ... your arduino settings will roll down the screen [1]
  7. click send ... the yellow virtual pen, and your plotter, should both start moving

[1]

Check your paper dimensions, and other settings, before you press “send”. If necessary correct them using the command line.

Step 8: Raising and Lowering Your Pen

There are several ways to control your vertical pen-movement should it raise when you want it lowered:

(1)

The simplest solution is to unscrew the servo arm and rotate the arm through 90 degrees as you are only using 90 degrees of the possible 180 degrees offered by servos.

(2)

Photo 1 shows a software method for reversing the your pen direction. Change the value of line 48 in “spindle_control.c” from 16 to 31, and the value of line 49 from 31 to 16, then recompile and upload GRBL to your arduino.

Changing these numbers slightly enables you to obtain 90 degrees exactly. In practice these values are close enough.

(3)

I discovered this method quite by accident ... but first we need some background.

In order to free-up the arduino PWM pin (pin 11) we swapped “spindle_control.c” with code of our own which tricks GRBL into accepting a command such as “M3 S1000” to move the servo-arm on our plotter. Similarly we use the command “M5” to restore the servo-arm to it’s original position.

While on the subject of M3 and M5, GRBL requires a NON-ZERO spindle-speed value before these commands will work. For this reason most programs send an intial “M3 S1000” to the plotter after which you can use M3 without the “S” (spindle speed) value.

Here is where you have to “think outside of the square”. “S1000” is not a command ... it is a value parameter that can be attached to either the “M3” or the “M5” command. Why then do most programs send an initial “M3 S1000” to the plotter, then use M3 for pen-down which leaves an unwanted ink-mark on your paper?

I get the impression that since you would only lower the spindle on a milling-machine while it is spinning, everyone uses “M3 S1000” for pen-down.

When writing GcodePostProcessor I decided to use M3 for pen-up and M5 for pen-down which works beautifully. The only problem that I have encountered is that your pen is is up when it should be down when sending G-code directly to your plotter from third-party programs. Okay ... just unscrew the servo-arm.

But there is a simpler solution ... instead of tricking GRBL with a little white lie (“M3 S1000”) why not tell it a great big whopper in the form of “M5 S1000” which, when interpreted, means “spindle off, but rotate at 1000rpm”... much to my amazement, this actually works!!!!

The beauty of “M5 S1000” is that our M3 and M5 commands are now in sync with the rest of the world. For this reason I have rewritten “GcodePostProcessor” using “M5 S100” to initialise the servo.

I have called this new version “GPP.pde” to avoid confusing the two programs. Download and “unzip” the attached “GPP.zip “file to your desktop (or other convenient location) and double-click the file “GPP.pde” to run.

The two extra “header” and “footer” files suppress Inkscape “headers “ and “footers” if you direct the g-code output from Inkscape into this folder. These two files are blank text files that have been renamed.

The file “target.gcode” is a small GPP test file should you wish to confirm that the program works as described ... just compare the contents of “target.gcode” with the contents of “target.gcode.gcode” once you have run GPP.

  Click here   to view my other instructables.

2 People Made This Project!

Recommendations

  • Trash to Treasure

    Trash to Treasure
  • Arduino Contest 2019

    Arduino Contest 2019
  • Tape Contest

    Tape Contest

43 Discussions

0
None
lingibsvenhb

Reply 10 days ago

Thanks for this update ... nice to know :)

0
None
pierluigis5

7 weeks ago

Thank you for your beautiful project, I wanted to ask you, with your modified version of grbl, is it still possible to use the LASER mode?
or with this modified GRBL it is only possible to use SERVO?
In fact, I wanted to make a machine that could use both modes without having to update the firmware every time ..
In practice, like plotters controlled by BENBOX software
thank you

1 reply
0
None
lingibpierluigis5

Reply 7 weeks ago

In answer to your question ... "I don't know" :(

But you have raised my curiosity !!

There are three versions of the file "spindle)control.c":
- the original version
- the version which I have archived in Step 3 of this instructable
- the latest version which may be found at https://github.com/bdring/Grbl_Pen_Servo

The original version supports the laser mode, details of which may be found at https://github.com/gnea/grbl/wiki/Grbl-v1.1-Laser...

The archived version is a substantial rewrite of spindle_control.c and requires that M4, M5 codes be inserted into the g-code output from Inkscape

The latest Github version uses the positive and negative z-axis values in the g-code output from Inkscape to raise and lower the pen. This version sounds promising. At present I don't have a laser to try.

The Notepad++ text editor has a file compare function, an example of which is shown in Step 1 of this instructable. My guess is that the code with the least changes is more likely to work.

My first approach to finding out would be to try each of these versions in turn. Sorry that I can't be more helpful. If I find an answer I will let you know.

0
None
Grypa

3 months ago on Step 8

Why you do not use Z axis for lifting the pen? Small stepper motor from an old floppy or CD, and no problems with changing code ? Z axis is exactly for this!

3 replies
0
None
lingibGrypa

Reply 3 months ago

Servos are commonly used in plotters as they do not require a motor controller and their low mass allows rapid XY acceleration.

I wrote this instructable as there is not a lot of information about using a servo with GRBL.

An example of how this instructable has been used by others may be found at https://github.com/WJonson/CNC-Object-Locator

0
None
Grypalingib

Reply 3 months ago

I am building laser engraving machine on GRBL. When I finish with a success, I try to write about this. Maybe I try to use servo from car lamps. Thanks for idea!

0
None
lingibGrypa

Reply 3 months ago

I look forward to your laser project. It sounds interesting. Good luck :)

0
None
bigantal

4 months ago

Hey lingib,
On the http://www.buildlog.net the code doesn't compile. It turned out that the source code is wrongly formatted. Some code lines are in comment sections.
Could you please fix the formatting, or upload the code to github if it's the blog's issue?
Thanks btw, it looks pretty useful.

1 reply
0
None
lingibbigantal

Reply 4 months ago

Thank you for commenting :)

A correctly formatted version of "spindle_control.c" is attached to this instructable ... see Step 3, Note 1.

0
None
jonwal61

Question 4 months ago on Introduction

Hi. I’ve built a plotter but the only thing I can’t seam to get right is the servo. It works fine with M3 and M5. But when running from gcode it goes in reverse. The pen is down during moves and up during drawing. Ant ideas what I could have done wrong?

3 answers
0
None
jonwal61jonwal61

Answer 4 months ago

Hi lingib. Well I was actually using GPP when this was happening. But my solution was to use the original code the ‘Gcodepostprosess’ version. And it worked fine. After that. I tried the GPP again after I got it working with the first version but again it was in reverse. So am sticking with first version. The only problem I have now is size. I have the 0:0 start point but it always tries to go off the page. I’ve started using a 100:100 page and it seams to help but still not perfect. Going to add endstop see if that will work. Thanks again for your reply.

0
None
lingibjonwal61

Reply 4 months ago

Glad that GcodePostProcessor.pde has solved your problem :)

I'm not certain that I understand your 100:100 problem?
If the command G00 X100 Y100 is moving your plotter more than 100 millimeters then you need to change the $100,$101,$102 values shown in Step 6.

The values of 80 for my plotter were calculated as follows:
GT2-20 motor pulley = 2*20 = 40mm per revolution
1.8 degrees per step motor = 360/1.8 = 200 steps per revolution.
Motor controller micro-stepping = 16
From which steps/mm = 200*16/40 = 80

0
None
lingibjonwal61

Answer 4 months ago

A solution to your problem is discussed in "Step 8: Raising and Lowering Your Pen".

"GPP.zip", attached to Step 8, contains a post-processor that should fix your issue.

The GPP post-processor is designed to work with Inkscape which generates an "M2" stop code. Non-Inkscape gcode may use M30 ... in which case edit the source code to suit.

0
None
BentarP

Question 5 months ago

I use SG90 Servo, Grbl 0.9j, Arduino Uno and Universal G-Code Sender

when I tried sending the M03 S90 servo command it moved as instructed
but the servo was hot and when I tried writing the m M05 servo the command remained in state 90
can you help my problem?

2 answers
0
None
lingibBentarP

Answer 5 months ago

The "spindle_control.c" file in Step 3 expects GRBLversion 1.1f.
You are using an earlier version ...

Some suggestions:
(1) Install GRBL version 1.1f and try again
(2) Check your wiring as it is unusual for a servo to overheat

0
None
BentarPlingib

Reply 5 months ago

Oke thanks sir
I will try
Sorry i bad english speak

0
None
HenryW72

5 months ago

Hi! Thanks so much for the tutorial! I'm having trouble with the new spindle_control.c file... I don't see anywhere to "download" it on the buildlog website, so I'm assuming I copy and paste the code? It's giving me trouble, as I think the formatting on the webpage has a few mistakes... Maybe I'm making a simple mistake, but I haven't edited anything yet. Arduino IDE is giving me syntax errors on the code I directly got from buildlog.

Thanks!

Henry

C:\Users\hwail\Documents\Arduino\libraries\grbl\spindle_control.c: In function 'spindle_set_speed':
C:\Users\hwail\Documents\Arduino\libraries\grbl\spindle_control.c:223:4: error: #else after #else
#else
^
C:\Users\hwail\Documents\Arduino\libraries\grbl\spindle_control.c:173:0: error: the conditional began here
#ifdef PEN_SERVO
^
C:\Users\hwail\Documents\Arduino\libraries\grbl\spindle_control.c: In function 'spindle_set_state':
C:\Users\hwail\Documents\Arduino\libraries\grbl\spindle_control.c:290:51: error: operator '&&' has no right operand
C:\Users\hwail\Documents\Arduino\libraries\grbl\spindle_control.c: In function 'spindle_set_speed':
C:\Users\hwail\Documents\Arduino\libraries\grbl\spindle_control.c:315:3: error: expected declaration or statement at end of input
}
^
exit status 1
Error compiling for board Arduino/Genuino Uno.


2 replies
1
None
lingibHenryW72

Reply 5 months ago


See note [1] in "Step 3: Modifying GRBL".
A copy of "spindle_control.c" is included there ...

0
None
HenryW72lingib

Reply 5 months ago

Right. On that page, I can't find a download link. I tried copying and pasting the spindle_control.c text from that page, but it runs with syntax errors (shown above) Is there a download link that I'm not seeing?

Thanks!