embedding g-code in an arduino sketch.

Please i want to develop a machine that doesnt require the streaming of g-code to the cnc machine but instead the gcode should be inside the arduno sketch. how can i go about this.

What is receiving the gcode? Can the receiver connect to an Arduino serial port?

groundFungus:
What is receiving the gcode? Can the receiver connect to an Arduino serial port?

the g-code is meant to control stepper motors. but what i need is for the g-code to be part of my arduino sketch not that the gcode should be sent to the arduino board via serial input.

Naytdgreat:
Please i want to develop a machine that doesnt require the streaming of g-code to the cnc machine but instead the gcode should be inside the arduno sketch. how can i go about this.

In any of the Arduino/CNC machines, the G-code is NOT STREAMED. Each line of instruction is sent in response to a completion message from the CNC machine.

Have you found all the similar threads in the Arduino forum? Must be 50 by now.

Paul

So a gcode interpreter is part of your sketch? Then save the gcode in a string array or string arrays to input to the interpreter. Without an interpreter, gcode is worthless.

And if your Arduino program includes a GCode interpreter you could store the GCode file on an SD Card if you attach an SD Card module to your Arduino.

...R

Don't use g code then. Just write the commands in the C code.

groundFungus:
So a gcode interpreter is part of your sketch? Then save the gcode in a string array or string arrays to input to the interpreter. Without an interpreter, gcode is worthless.

Forgive me, I am new to this, What exactly is a gcode interpreter?

MorganS:
Don't use g code then. Just write the commands in the C code.

I can't write the commands in C because I'm working with an image file which needs to be converted to gcode first. But in my case, I want to use more than one image file with a select statement that selects one of the Image and prints it that is when a statement evaluates to true.

Naytdgreat:
Forgive me, I am new to this, What exactly is a gcode interpreter?

A GCode interpreter is a program (or part of a program) that can read a line of GCode and figure out the number of steps and the speed of the steps for each stepper motor in order to get the tool to move the distance defined in the line of GCode.

...R

How big are these images when converted to g code? You probably don't have enough memory to store even one. Remember the Arduino memory is measured in Kb and the smallest SD card you can buy is 2Gb. Nearly a million times bigger.

kB, not Kb, GB, not Gb!

k means 1000
b means bit
B means byte

Some of these differences really matter!

Here is an open source tool that might help you do the conversion to G-code if you haven't gotten one already. An Intro to G-code and How to Generate It Using Inkscape – Norwegian Creations

MarkT:
kB, not Kb, GB, not Gb!

k means 1000
b means bit
B means byte

Some of these differences really matter!

So which ones of those differences are helping the OP?