GRBL Jog-Controller

Hello guys,
I am currently hitting a roadblock in my project. A quick overview:
I have got an Uno with an GRBL-Shield and a Mega. The Uno has GRBL flashed onto it (working) and is connected to the Mega via softwareserial. The Mega is connected via USB.
Now when i send an command to the Mega it gets successfully sent to the Uno. Eg sending a "G1 X1" moves the x axis and so on. However i cant get feedback from the Uno. GRBL commands such as "?" or "$$" dont return anything to the Mega. If I connect the Uno directly with USB to the PC I get a "response".
I am pretty confused why i cant seem to get a reply (or a visible reply" from the uno to the mega. Sending works but not receiving? Weird.

 #include <SoftwareSerial.h>
SoftwareSerial mySerial(8,9); //RX, TX

int buttonPin = 2;
int ledPin = 13;

long loopmillis = 0;

long delays_I = 1000;
long pmills_I = 0;
int stage_I = 0;

String Input = "";

long delays_Inputs = 100;
long pmills_Inputs = 0;
int buttonState = 0;
int lastbuttonState = 0;

void setup()

  pinMode(buttonPin, INPUT);
  pinMode(ledPin, OUTPUT);

void loop()
  loopmillis = millis();
  if(stage_I <= 1 && loopmillis > pmills_I + delays_I)

  buttonState = digitalRead(buttonPin);
   if(buttonState == HIGH && lastbuttonState == LOW)
    digitalWrite(ledPin, HIGH);
    SendCommand("G1 X1", "Button");
    lastbuttonState = HIGH;
    digitalWrite(ledPin, LOW);
   if(buttonState == LOW && lastbuttonState == HIGH)
    lastbuttonState = LOW;

   if(Serial.available() > 0)
    Input = Serial.readString();
    if(Input[0] == '<')
      String InputS = Input.substring(1);
      Serial.println("< fehlt");

void INIT()
    case 0:
    case 1:
    pmills_I = millis();

void SendCommand(String cmd,String src)
  Serial.println("S_"+src+": "+cmd);

38400 is the fastest that SoftwareSerial will work, despite what the reference may say.

38400 is the fastest that SoftwareSerial will work, despite what the reference may say.

I assume this is the limit for receiving, not sending, as I remember using SoftwareSerial successfully sending at that speed. It's for me mostly debugging, not as extra Serial port.
Now I wonder why the OP even uses SoftwareSerial. That sketch is no doubt for the Mega which has multiple hardware UARTs available.
OP should also get rid of the String class. That's just an additional source of problems, and totally unnecessary. Regular c-strings work perfectly fine and easy.

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.