Welcome! Log In Create A New Profile

Advanced

Launching terminal commands from Marlin firmware

Posted by jessicabrenner 
Launching terminal commands from Marlin firmware
November 11, 2015 10:14PM
I want to send commands to my mac's Terminal application (command line) from the Arduino. Does anyone know if its possible to do this directly? Or would I have to send serial data to another application (such as Pronterface) and have that application send the commands to Terminal?
Re: Launching terminal commands from Marlin firmware
November 12, 2015 03:59AM
Don't know Mac, but in windows any terminal program that is connected to the COM-port of the arduino will show the incoming data.
-Olaf
Re: Launching terminal commands from Marlin firmware
November 12, 2015 05:00AM
What exactly are you trying to achieve with this?.. Sounds like an overly complicated task that can be solved easier other way around (since your mac sends Gcode to the board it knows what board is currently doing).
Re: Launching terminal commands from Marlin firmware
November 12, 2015 08:56PM
Thanks for the replies. Could be overcomplicated, so if you have other suggestions on how to do this, please let me know!

With one custom g-code command entered into pronterface, I want to move the carriage to a specific location, then trigger a USB camera (connected to the same computer the arduino/ramps is connected to) to take a picture as soon as it reaches that location (with preferably no waiting). Depending on where the carriage is located, it might take a short amount of time, or a long time for the carriage to complete the move.

From Terminal on mac I can just type the following to take a picture from the USB camera.
imagensap -d “USB 2.0 Camera”

But if there's a way to get this imagensap command to be triggered by the arduino, that would be best.

A less preferable alternative is to launch the imagesnap command from pronterface, but pronterface doesn't know when that initial move has completed, and I don't know how to do that anyways.
Re: Launching terminal commands from Marlin firmware
November 13, 2015 02:32AM
- wrong thread - sorry

Edited 1 time(s). Last edit at 11/13/2015 02:33AM by Wurstnase.


Triffid Hunter's Calibration Guide --> X <-- Drill for new Monitor Most important Gcode.
Re: Launching terminal commands from Marlin firmware
November 13, 2015 03:46AM
Marlin has provisions to trigger a camera, but I don't know if that would work with yours.
What it actually does, is described in the link ( or can be altered by you?) . If that does it for your camera, try out "M240"

// M240  Triggers a camera by emulating a Canon RC-1 Remote
// Data from: [www.doc-diy.net]
// #define PHOTOGRAPH_PIN     23

Here is the full code:

case 240: // M240  Triggers a camera by emulating a Canon RC-1 : [www.doc-diy.net]
     {
     	#ifdef CHDK
       
         SET_OUTPUT(CHDK);
         WRITE(CHDK, HIGH);
         chdkHigh = millis();
         chdkActive = true;
       
       #else
     	
      	#if defined(PHOTOGRAPH_PIN) && PHOTOGRAPH_PIN > -1
	const uint8_t NUM_PULSES=16;
	const float PULSE_LENGTH=0.01524;
	for(int i=0; i < NUM_PULSES; i++) {
        WRITE(PHOTOGRAPH_PIN, HIGH);
        _delay_ms(PULSE_LENGTH);
        WRITE(PHOTOGRAPH_PIN, LOW);
        _delay_ms(PULSE_LENGTH);
        }
        delay(7.33);
        for(int i=0; i < NUM_PULSES; i++) {
        WRITE(PHOTOGRAPH_PIN, HIGH);
        _delay_ms(PULSE_LENGTH);
        WRITE(PHOTOGRAPH_PIN, LOW);
        _delay_ms(PULSE_LENGTH);
        }
      	#endif
      #endif //chdk end if
     }
    break;


-Olaf

Edited 3 time(s). Last edit at 11/13/2015 03:52AM by o_lampe.
Sorry, only registered users may post in this forum.

Click here to login