Command to wait for cyclestart button is pressed?

Post anything you want to discuss with others about the software.

Re: Command to wait for cyclestart button is pressed?

Postby dezsoe » Mon May 25, 2020 9:11 am

I had to modify your code a bit to sure stop and now it works fine:

Code: Select all
while (exec.IsMoving());                                                        // Wait for the last command to finish

exec.Stop();
while (exec.IsMoving() || exec.GetLED(54));                                     // Cycle stop and wait to really stop

exec.AddStatusmessage("Insert tool #1");

while (!(exec.GetLED(54) || exec.Ismacrostopped())) Thread.Sleep(20);           // Wait for Cycle start/stop

if (exec.Ismacrostopped()) return;                                              // If stopped then finish

while (exec.IsMoving());

//Probing

/*
exec.Code("G00 G53 X0 Y15"); // move to probing location
exec.Code("G00 G53 Z-100"); // dive tool to a comfortable height above the probe for the longest tool you have
exec.Code("G91 G31 Z-150 F100"); // Probe Z quickly to get rough height
exec.Code("G90");
while (exec.IsMoving());
*/

// You can execute a list of commands with one call to be absolute safe
List<string> codelist = new List<string>(); //Create a new List of strings.
codelist.Add("G00 G53 X0 Y15");                                                 //Add g-code lines to the List.
codelist.Add("G00 G53 Z-100");
codelist.Add("G91");
codelist.Add("G31 Z-150 F100");
codelist.Add("G90");
exec.Codelist(codelist);                                                        //Execute the List of g-codes.
while (exec.IsMoving());

I added G0s to the move commands, because if the last command was not G0 then it can do strange things. :)
dezsoe
 
Posts: 2093
Joined: Sun Mar 12, 2017 4:41 pm
Location: Csörög, Hungary

Previous

Return to General discussion about the UCCNC software

Who is online

Users browsing this forum: No registered users and 22 guests