Gcode question- wait


#1

Hello. Im currently using a XY plotter and I am new to this. I am trying to send all the commands with GCode. I would like to know if there is any GCode which willl make XY Plotter stop and wait in its position for a certain amount of time?
I have tried this forum and found that there is a GCode called G04(Dwell) but so far it has not worked for me. Has anyone succeded with this funciton?
Thanks in advance.


#2

Hi jellybean1h

Here is some instruction related to Gcode of the XY Plotter to you for reference.Hope it helps.


#3

I have seen that there is a user that said that by implementing the Gcode G00 with A which is used as a ‘dwell’. Has anyone used it and succeded? I tried and it didn’t work.


#4

You don’t specify which of the three controlling software suystems you are using. If you are using BenBox I cannot say how it operates internally in response to GCode because it is closed-source, and from memory GRemote did not implement anything.

mDraw has an Auxiliary delay methoid which does attempt a delay as a trailing command to a move by using the Annn format. (G01 Xnnn Ynnn Fnnn Annn), but there is no Arduino code to respond to any GCodes other than G00, G01 or G28.

In posts a couple or more years ago a user (BigNick?) suggested that because the Arduino code used integers instead of longs to adjust the delay in the code there would be errors caused by overflow when trying to move very slowly. He published some revisions to the code which worked.

To further complicate the issue, the code which comes with the XYPlotter used one of the reserved words “speed” as a variable, which makes looking through the code to sort this out a bit of a challenge at first.

I have altered both my Python and Arduiino code considerably from that which comes in the GitHub releases so I don’t think I would help by publishing snippets.

My advice is for you to look at the block of code in the function “parseCoordinates” which assigns a numeric quantity following “A” to a variable stepAuxDelay and track it from there through the code to the end of the function “DoMove” where stepAuxdelay is used in calculating the time to be spent doing nothing before the next move is started. If you want to implement something such as G04 nnnn you will have to add code to implement this yourself, so the use of Annn as a trailing specifier to the move commands (or even as a standalone setting G01 Annn) to only alter stepAuxDelay ) seems a simpley way forward.


#5

@Adrian_S I am actually using the GCodes found in the arduino to create an interface with the help of Labview to control the XY PLotter. In the ardunio code provided by makeblock, there is a G04(dwell) function implimented as shown in the picture below.
image
It is under process_string under the GCodeParser. However, I have tried to use this funciton but to no avail. Also, can I know where can I find the ‘parseCoordinates’ and ‘DoMove’ functions? I have tried to search for it in the GCodeParser but I couldn’t find it.

Also, does the arduino not take into account the other GCodes other than the G00, G01 and G28 function?

I apologize if I ask too many questions as I am still a noob in this. I will also take a look at the BigNick file that you mentioned!


#6

I stopped using GRemote when mDraw came out because mDraw was several orders better both in terms of UI and in terms of smooth stepper movements. My comments above were assuming you were using mDraw, and therefore aren’t of any use to you.

ETA

I have just un-archived the notes from two years ago which include GRemote.

I think the reason you have thought dwell isn’t working is because you have been putting in a command to Dwell for 1.0 seconds, which would then result in a dwell for 1 millisecond, which you would not be able to detect. Try putting in a dwell command for 1000, 2000, or 3000, which will give delays of 1, 2 or 3 seconds.

Search_string returns a floating point double which is cast to an int, so you can only dwell for 1, 2, 3, 5 etc milliseconds as a result of rounding 0.5, 1.2, 3.3, 4.7 to integer values. If you multiply the value returned from search_string by 1000.0 before the cast to an int, you will be able to dwell for fractions of a second, 0.5 becoming 500 after scaling, which will then delay 500 milliseconds, or greater amounts, 1.5 becoming 1500 milliseconds.


#7

I have tried this again but yet it does not seem to work at all.


#8