-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Galvo’s movement using the G-Code #16
Comments
what is the Galvo’s device you are using? i think it may be because your just setting your DAC and that will send it to a point, you may need to fade it. |
Now I've changed the code. G0 X10 Y10 It looks like he started drawing the first line but doesn't finish drawing and then immediately jump to the second if ( read_new_line == true ) Commands.available(); dac.setVoltageA(x_i); } void mov() //#### Y if ( ( x_i == stepsx ) && ( y_i == stepsy )) read_new_line = true ; } void gotoLocation(double x,double y) } |
How can I pause reading from Buffer? |
It works now. ` if ( ( x_i == stepsx ) && ( y_i == stepsy )) Commands.available(); // !!!!!!!!!!!!!!! dac.setVoltageA(x_i); } void mov() //#### Y } |
sorry been busy, but looks like you sorted it out. looks good |
In the end, it would take a communication protocol so that my firmware can communicate with GRBL. |
Unit correction (mm) is complete. |
thanks mate for the information |
Can anyone help me?
This is the code that controls Galvo's movement using the G-Code.
The base code works, but only in a simple form. Galvo jump between positions. It is not possible to control the speed.
I want Galvo to move smoothly. (Code part deactivated) It works in another code, but not in this one. Galvo doesn't move at all.
I don't know what I'm doing wrong.
`#include <gcode.h>
#include <MCP48xx.h>
MCP4822 dac(53); // CS Pin 53
#define LDAC 48 // LDAC Pin
#define Laser 47 // Laser Pin
unsigned int x_i = 0;
unsigned int y_i = 0;
#define F_mSec 10
#define STEPS_MM 10
float stepsx;
float stepsy;
double X;
double Y;
void moviment_0();
void moviment_1();
void gotoLocation();
#define NUMCOMMANDS 2
commandscallback commands[NUMCOMMANDS] = { { "G1",moviment_1} , {"G0", moviment_0} };
gcode Commands(NUMCOMMANDS,commands);
void setup()
{
Commands.begin();
}
void loop() { Commands.available(); }
void gotoLocation(double x,double y)
{
stepsx = xSTEPS_MM; // In value X mm to DAC Output 0 = 4000mV
stepsy = ySTEPS_MM; // In value Y mm to DAC Output 0 = 4000mV
/*
//#### X
if (stepsx >= x_i ){x_i ++ ; if (x_i >= stepsx) x_i = stepsx; delayMicroseconds(F_mSec); } // Move X ++
else
if (stepsx <= x_i ){x_i -- ; if (x_i <= stepsx) x_i = stepsx; delayMicroseconds(F_mSec); } // Move X --
//#### Y
if (stepsy >= y_i ){y_i ++ ; if (y_i >= stepsy) y_i = stepsy; delayMicroseconds(F_mSec); } // Move Y ++
else
if (stepsy <= y_i ){y_i -- ; if (y_i <= stepsy) y_i = stepsy; delayMicroseconds(F_mSec); } // Move Y --
*/
delay(10);
}
//### G00
void moviment_0()
{
double new_0_XValue = X;
double new_0_YValue = Y;
if(Commands.availableValue('X')) // ADDED parameter X in G0
new_0_XValue = Commands.GetValue('X');
if(Commands.availableValue('Y')) // ADDED parameter Y in G0
new_0_YValue = Commands.GetValue('Y');
}
//### G01
void moviment_1()
{
double new_1_XValue = X;
double new_1_YValue = Y;
if(Commands.availableValue('X')) // ADDED parameter X in G1
new_1_XValue = Commands.GetValue('X');
if(Commands.availableValue('Y')) // ADDED parameter Y in G1
new_1_YValue = Commands.GetValue('Y');
}`
The text was updated successfully, but these errors were encountered: