How to get Gcode in matlab ?

i want to run my laser machine over a particular path for that i need gcode. so how it can be done in matlab ?

 Accepted Answer

Walter Roberson
Walter Roberson on 27 Apr 2018

13 Comments

I want for line not text ! Is there any code for line ?
All of the 'lent' entries in that file are indicating straight line cuts. All of the 'tourHoraire' and 'tourAntihoraire' are indicating arc cuts. All of the 'rapide' entries in that file indicate movement.
See https://www.tormach.com/g_code_table.html for the reference material.
In summary: Emit a G0 to move to a position. Emit a G01 to draw straight. Emit a G02 to turn clockwise, and G03 to turn counter-clockwise.
You need to decide whether you want to cut your shapes into the sheet, or if you want to cut everything away except your shapes.
i have a gcode for this line ... now how can use that gcode in matlab to move my machine attached with arduino.
How is your arduino attached to your MATLAB host? How is your CNC attached to your arduino? Do you have two serial ports on your arduino, one to talk to MATLAB and the other to talk to the CNC?
Arduino is attached using the matlab ad-ons ...and my laser machine is connected to arduino.
Are you using:
  • a very old PC with a DB25 parallel connector and parallel to serial adapter to connect to the arduino
  • an old PC with a DB25 RS232 connector to connect to the arduino
  • a less-old PC with a DB9 connector to connect to the arduino
  • a PS/2 DIN-6 port with a PS/2 to DB9 adapter to connect to the arduino
  • a USB port with a USB to serial adapter to connect to the arduino
  • a USB port to a USB port on the arduino
  • a USB port with a USB to TTL adapter connecting to a TTL port on the arduino
  • a pair of zigbees connecting the PC to the arduino
  • regular wifi on the PC connecting to a zigbee connected to the arduino
  • ethernet connecting the PC to the arduino directly
  • PC and arduino are both connected by ethernet by way of a hub or switch
  • something else?
a USB port to a Usb port in the arduino.
I cannot tell which model of arduino you are using. You appear to have some kind of red DC Shield on top but I do not seem to find a match for it (the ones I can find do not say "DC Shield" in the same position.)
Based upon what I can make out from the picture, it looks to me as if you are not using USB to connect from the arduino to that white device: the connection appears to on some kind of DIN connector.
that white wire is a USB connector. i am using arduino uno and above that a cnc shield is used.
any help ?
Walter Roberson
Walter Roberson on 29 Apr 2018
Edited: Walter Roberson on 29 Apr 2018
You could probably use serial() to open a serial port connection to the COM port that the arduino is on, and then send it the gcode strings. It looked to me as if that software would accept the strings and act on them.

More Answers (0)

This question is closed.

Tags

Asked:

on 27 Apr 2018

Closed:

on 3 May 2018

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!