Master/Slave Serial Communication - ESP8266 and GRBL Uno

Hello,

Could someone please provide an example Arduino sketch for g-code serial communication between a Master ESP8266 and Slave GRBL Uno using RX/TX pins?

  • I am trying to send g-code from a master ESP8266 to the slave GRBL Uno using serial commands embedded in an Arduino sketch.
  • I able to run the attached code on the ESP8266 and it moves the gantry system once, then i receive an error from the GRBL Uno serial monitor (see below).
#include <SoftwareSerial.h>

SofwareSerial s(3,1);

void setup(){
  Serial.begin(115200);
}

void loop(){
  s.write("G00  X-100\n\r");
  delay(1000);
}

GRBL UNO SERIAL MONITOR:
ok
error: Line overflow
error: Bad number format
ok
ok
ok

This page tells how to interface with grbl.