Author Topic: Add or edit Mach4 Lathe screen  (Read 589 times)

0 Members and 1 Guest are viewing this topic.

Offline daniba73

  • Active Member
  • Posts: 105
    • View Profile
Add or edit Mach4 Lathe screen
« on: November 09, 2018, 04:04:03 AM »
Hi everyone

Is it possible to add a sound to the "Change tool" LED?
A simple "beep" at every impulse would be excellent.

Mach4 starts with a 100% slide Rapid Rate
Is it possible to change this condition and start with 25%?

Offline Cbyrdtopper

  • Active Member
  • Posts: 614
    • View Profile
    • Byrd Tool Corp.
Re: Add or edit Mach4 Lathe screen
« Reply #1 on: November 09, 2018, 10:34:25 AM »
You can have your Rapid Rate Override set to 25% in the PLC script on start up.
Put this code in the PLC Script from the screen editor.


--Featured added 11-9-18
--Set RRO to 25% on start up
if testcount == 1 then
    mc.mcCntlSetRRO(inst, 25)
end


As far as playing a tone off the computer through speakers, I'm not sure, someone else would need to help you with that.

But, I have Stack Lights that have buzzers integrated in them on our machines here at the shop, you can use the "Tool Change" output in the mach configuration and map it to a relay that runs a buzzer or beeper.  You can get simple buzzers on ebay or places like Automationdirect.com. 
Chad Byrd

Offline rhtuttle

  • Active Member
  • Posts: 346
    • View Profile
Re: Add or edit Mach4 Lathe screen
« Reply #2 on: November 09, 2018, 02:20:42 PM »
local snd=wx.wxSound('c:\\Windows\\Media\\chord.wav',0)
snd:Play()

HTH

RT

Offline Cbyrdtopper

  • Active Member
  • Posts: 614
    • View Profile
    • Byrd Tool Corp.
Re: Add or edit Mach4 Lathe screen
« Reply #3 on: November 09, 2018, 02:46:32 PM »
RT,
So... snd:Play()   plays the sound.   
Does it play the file once and stop?
Chad Byrd

Offline daniba73

  • Active Member
  • Posts: 105
    • View Profile
Re: Add or edit Mach4 Lathe screen
« Reply #4 on: November 10, 2018, 03:25:57 PM »
Hi,
I report this error.
unexpected symbol near 'if'


acoustic signal instructions where should I enter?
if I put it in PLC it will only sound when I open Mach4.

Offline Cbyrdtopper

  • Active Member
  • Posts: 614
    • View Profile
    • Byrd Tool Corp.
Re: Add or edit Mach4 Lathe screen
« Reply #5 on: November 12, 2018, 11:18:26 AM »
Sorry for the delay in response.
Make sure you put custom code towards the end of the PLC script.
That way you don't put it inside another section of code.
Also be sure that the comments have the "--" in front of them.  That makes it a comment in LUA.

I forgot you want this to sound during your tool change. 
You can still put this in your PLC Script.  But now, you will need to get the handle of the Tool Change Output.
When the Tool Change Output is active, play the sound.
I will see if I can get this to work on my computer in the sim and post my findings.
« Last Edit: November 12, 2018, 11:22:40 AM by Cbyrdtopper »
Chad Byrd

Offline daniba73

  • Active Member
  • Posts: 105
    • View Profile
Re: Add or edit Mach4 Lathe screen
« Reply #6 on: November 12, 2018, 12:32:31 PM »
Hi,
It's not a problem, I'm not in a hurry.
the error report was referred to this:

--Featured added 11-9-18
--Set RRO to 25% on start up
if testcount == 1 then
    mc.mcCntlSetRRO(inst, 25)
end

Offline Cbyrdtopper

  • Active Member
  • Posts: 614
    • View Profile
    • Byrd Tool Corp.
Re: Add or edit Mach4 Lathe screen
« Reply #7 on: November 12, 2018, 01:36:50 PM »
That's the exact code I've got in my PLC script and it is working fine.
Did you put it at the end to make sure it isn't inside another bit of code?
Chad Byrd

Offline daniba73

  • Active Member
  • Posts: 105
    • View Profile
Re: Add or edit Mach4 Lathe screen
« Reply #8 on: November 14, 2018, 10:34:20 AM »
Hi,
Yes sure
I attach image.

Offline Cbyrdtopper

  • Active Member
  • Posts: 614
    • View Profile
    • Byrd Tool Corp.
Re: Add or edit Mach4 Lathe screen
« Reply #9 on: November 14, 2018, 11:01:27 AM »
Hmm..
Try and take the code out of the PLC Script to see if you are still getting the error. 
I moved my code to the top of the PLC script to be sure it was still working; it is.

Chad Byrd