Sending G-code to ultimaker (Marlin 13.03 firmware)
in
Integration and Hardware
•
4 months ago
Hello,
I'm trying to do a processing sketch that generates some G-Code, and then sends it to the 3D printer.
The G-code generating it's fine, but I have problems in the comunication with the printer, as it seems to do nothing with the Gcode I send to it.
This is a example code of the communication with the printer, sending the code "G28 Z0" for putting the z-platform in the origin, but it does nothing. When I start the sketch, the printer seems to start, but then does nothing when I send the code.
Also, when the communication starts, the sketch receives some data from the serial communication, that is something like this: "¨¡ŒŒ„©`‡¤žÖ-9î©ÌŠHì†Äi}Ú˜?Cjóá"
I've tried different baudrates and the result is similar...
Here is the sample code:
The firmware of the ultimaker it's "Marlin 13.03 (250000_single)",
Any help would be much appreciated
I'm trying to do a processing sketch that generates some G-Code, and then sends it to the 3D printer.
The G-code generating it's fine, but I have problems in the comunication with the printer, as it seems to do nothing with the Gcode I send to it.
This is a example code of the communication with the printer, sending the code "G28 Z0" for putting the z-platform in the origin, but it does nothing. When I start the sketch, the printer seems to start, but then does nothing when I send the code.
Also, when the communication starts, the sketch receives some data from the serial communication, that is something like this: "¨¡ŒŒ„©`‡¤žÖ-9î©ÌŠHì†Äi}Ú˜?Cjóá"
I've tried different baudrates and the result is similar...
Here is the sample code:
- import processing.serial.*;
- // Serial and communication variables
- Serial myPort; // Create object from Serial class
- String portName="COM5";
- void setup()
- {
- size(600,335);
- myPort = new Serial(this, portName, 250000); //9600 115200 250000
- }
- void draw(){
- background(20);
- if(myPort.available()== 0){
- //Sending Gcode
- myPort.write("G28 Z0 "+ '\n');
- }
- else{
- byte[] inBuffer = new byte[7];
- inBuffer = myPort.readBytes();
- myPort.readBytes(inBuffer);
- if (inBuffer != null) {
- String myString = new String(inBuffer);
- println("READED BYTES: "+myString);
- }
- }
- }//END DRAW
The firmware of the ultimaker it's "Marlin 13.03 (250000_single)",
Any help would be much appreciated
1