Processing Forum
- 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