Welcome! Log In Create A New Profile

Advanced

How to manually execute G-Code commands

Posted by CDorn 
How to manually execute G-Code commands
February 11, 2022 11:37AM
Hi everyone!
Im trying to create my own controll software for the Ramps1.4 board using Marlin. I'm using a Arduino Mega with the Ramps 1.4 shield on top. The idea is to controll that board via USB cable and my own python script on the PC.

My question is this:
  • Is there a library for Python, where I can send the G-Code commands via the COM? Or is there something similar? If yes, where? Because I cant find anything :/
  • alternatively: Can I add my own .h file to the marlin code, where I execute the G-Code commands manually? In marlin I found the queue.h file, where is says that the G-Code commands are stored and later executed via a 'dispatcher'. where is that dispatcher function and what is its name?
    Ideally there would be a function like execute_code(g_code), which could be activated.

Thanks in advance!
-CDorn
Re: How to manually execute G-Code commands
February 11, 2022 06:56PM
1) printrun/pronterface and it subsystem pronsole.py
2) example queue.enqueue_now(F("G91"));
VDX
Re: How to manually execute G-Code commands
February 12, 2022 01:31AM
... I'm using Masrlin4Due (same as Marlin, but for ArduinoDue) as firmware for ultrasonic cleaning systems for moving the basket from/to different positions, switching the US-senders and pneumatic actors or reacting to sensors by sending the G-codes directly to the ArdinoDue with "plane" RS232 in a VisualBasic environment.

It's as simple as invoking a serial port, setting port-number and baudrate, then transfer the command (e.g. "G0 X3800 Y400 F2000" to move the basket down into a vat) and receiving the echo from the port for checking the success (or receive errors or temperature values) ...


Viktor
--------
Aufruf zum Projekt "Müll-freie Meere" - [reprap.org] -- Deutsche Facebook-Gruppe - [www.facebook.com]

Call for the project "garbage-free seas" - [reprap.org]
Re: How to manually execute G-Code commands
February 14, 2022 05:25AM
Thanks to both of you! Ill test out your recomendations and tell you how it went!
Sounds promising!
Re: How to manually execute G-Code commands
February 14, 2022 05:34AM
Wow. I cant believe how simple it is to send commands... I typed the G-Code into the serial monitor and it just woked.
Thank you very much!!
Re: How to manually execute G-Code commands
February 14, 2022 05:37AM
Only issue is waiting for ok between commands, and you have to use uppercase
Re: How to manually execute G-Code commands
February 14, 2022 08:01AM
The 'ok' and uppercase is no problem. smiling smiley

May I ask how I execute the queue.enqueue_now(F("G91")); ?
the enque_now_P is the only function I found.
Sorry, only registered users may post in this forum.

Click here to login