GRBL and Arduino Sketch Serial Communication

I am trying to combine GRBL's stepper motor control with Arduino sketches. Does anyone know if it is possible for an Arduino sketch to send commands to GRBL? I have an Arduino Uno with both the GRBL and Arduino bootloaders. When I go into Arudino's serial monitor I can type the g-code command "G91 G0 X1" to GRBL and my machine moves 1 mm to the left. When I upload a the following sketch, nothing happens,

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

void loop(){
  Serial.write(“G91 G0  X1\n\r”);
  delay(1000); 
}

Thanks in advance.

Have you two Arduinos, one running GRBL and one running your sketch?

If so please describe how they are connected, and what sort of Arduinos you are using.
...R

Thanks Robin for the quick response.

Right now I am using one Arduino. I was hoping there would be a way to communicate between the GRBL and Arduino bootloaders on a single Arduino. If this is not possible, I plan to trying a setup with two Arduinos next.

Hi,
could you move your machine by typing on Arduino's Serial Monitor? If so, did you use a special library and made your own code through the library?
I have a similar problem. I want to move a CNC machine through Arduino. I thought to use the Serial Monitor, but I don't know how to send the G-codes to the machine. If you can help me.

Thanks

dbarbosa:
I have a similar problem. I want to move a CNC machine through Arduino. I thought to use the Serial Monitor, but I don't know how to send the G-codes to the machine. If you can help me.

This is like "how long is a piece of string?"

GRBL is a program that controls a CNC machine through an Arduino. I haven't used it but I understand that it takes G Code as its input.

If you don't want to use GRBL there is nothing to stop you writing your own code to interpret G Codes and control stepper motors.

My own interest is in using my PC to convert the G Code into step and direction instructions that the Arduino can use to control the stepper motors through a simple Arduino program.

And of course there is no reason why you could not develop an alternative to G Code if that's what you want.

This demo shows how to use a Python program on a PC to communicate with an Arduino. There is also a JRuby version for those who prefer that. The Arduino code will also work with input from the Serial Monitor.

I guess you need to decide what you want to do.

...R