Hello Guest it is April 19, 2024, 03:28:00 PM

Author Topic: How to show the value of a variable in the ZeroBrane Editor?  (Read 2820 times)

0 Members and 1 Guest are viewing this topic.

Re: How to show the value of a variable in the ZeroBrane Editor?
« Reply #20 on: August 04, 2019, 07:12:03 PM »
Hi,

Quote
I don't think I really need to keep getting the warnings.

My apologies.


Quote
I am confused. How do I make my tool changer work without using Lua coding?

Have you even looked at the toolchanger scripts that come as examples? Most people find that a couple of tweaks
to one of the examples is enough, no 'real' coding required.

Craig
'I enjoy sex at 73.....I live at 71 so its not too far to walk.'

Offline jevs

*
  •  315 315
    • View Profile
Re: How to show the value of a variable in the ZeroBrane Editor?
« Reply #21 on: August 04, 2019, 07:22:27 PM »
Yes, many times and watched all the videos many times. I don't just have a little router off ebay that I need to move over to a spot and manually pull out a tool.
I need to shut the spindle off, make sure it is off, record the positions, move to z0, move to x, y positions, then move Z up past home to Z5.800 and back down to z3.8 how many ever times it takes to get to the called for tool, go over and measure the tool, then go back to where it all started Etc.
It is a simple tool changer, but not as simple as the example scripts. I made this work with the VB script in much less time, but that was still a learning experience also. Trust me, I have a lot of hours in this changeover already and an overload of info.

Basically this thread we are talking on now is solved though. I got a pretty good handle on the editor at this point. It is not the stall point anymore. 

I have the example scripts for the tool change working, it is just adding what I need in there is the challenge.
I need to duplicate this, but also some things seem to be different with Mach4 and I need to add in the tool measure at some point....
https://www.youtube.com/watch?v=W-0q5uM8jbU

Code: [Select]
'Tool change macro for 7 tool turret
Sub Main()
'Sets variable OldTool to what is currently loaded
OldTool=GetCurrentTool()

'Sets Variable MaxToolNum to the max number of tools possible
MaxToolNum=7

'Sets variable Newtool to the one being selected with M6 T#
NewTool=GetSelectedTool()

'Get positions before moving to do tool change
x = GetToolChangeStart( 0 )
y = GetToolChangeStart( 1 )
z = GetToolChangeStart( 2 )
a = GetToolChangeStart( 3 )
b = GetToolChangeStart( 4 )
c = GetToolChangeStart( 5 )

'If the current tool loaded is 0 or greater than 7 then tool has been lost
'so need to ask what tool is currently loaded
While OldTool=0 Or OldTool>7
OldTool=Question ("Current tool unknown, enter tool in spindle 1 to " & MaxToolNum)
Wend

'Sets CurrentTool to Oldtool in case it was lost and entered above
SetCurrentTool(OldTool)

'When the tool asked for is invalid then this makes you select a valid tool
While NewTool > MaxToolNum Or NewTool <1
NewTool = Question ("Invalid tool chosen, enter tool number 1 to " & MaxToolNum)
Wend

        'If the tool asked for is the same one that is already loaded then exit macro
If NewTool=OldTool Then
Message "Tool already loaded or tool not specified with T# (ex:M6 T4)"
Exit Sub
End If

'Turn off soft limits if they are on
If GetOEMLED(23) Then
DoOEMButton(119)
End If

'Moves To Z home from where ever it is
code "G53G0Z0"
While IsMoving()
Wend

'Sets ChangeNums to 0 for safety in case it is not at 0
ChangeNums=0

'Makes the magic happen and moves the proper number of times if new tool is higher than old
If NewTool>OldTool Then
For ChangeNums=1 To NewTool-OldTool

'Moves Z axis to the top of tool change
code "G53 G1 F70 Z5.800"
While IsMoving()
Wend

'Moves back to bottom of tool change area
code "G53 G1 F70 Z3.8"
While IsMoving()
Wend

Next

'Makes the magic happen and moves the proper number of times if new tool is lower than old
Else
For ChangeNums=(OldTool-NewTool) To 6

'Moves Z axis to the top of tool change
code "G53 G1 F70 Z5.800"
While IsMoving()
Wend

'Moves back to bottom of tool change area
code "G53 G1 F70 Z3.8"
While IsMoving()
Wend

Next
End If

'Move Back to Z Home
code "G53 G1 F70 Z0"
While IsMoving()
Wend

'Should be a succesful tool change at this point so this sets the NewTool as the current tool
SetCurrentTool(NewTool)

'Turn back on soft limits
DoOEMButton(119)
End Sub           

Re: How to show the value of a variable in the ZeroBrane Editor?
« Reply #22 on: August 05, 2019, 07:36:38 AM »
Hi,

Quote
Yes, many times and watched all the videos many times

I was not talking about videos......what about the example scripts?

Mach4Hobby/LuaExamples/ToolChanger.......there are four scripts that might give you some ideas.

Craig
'I enjoy sex at 73.....I live at 71 so its not too far to walk.'

Offline jevs

*
  •  315 315
    • View Profile
Re: How to show the value of a variable in the ZeroBrane Editor?
« Reply #23 on: August 05, 2019, 08:50:16 AM »
Unfortunately those tool change examples do not exist in the latest download that I have. I only get the one stripped out M6 that is in the profile macros folder. I did notice in one of the Artsoft videos I saw that they had this folder you mention in their examples, but she did not go into it to see what is in there. After I noticed that, I double checked mine and it is no longer included I guess.
I would love to have some examples of something more for an ATC that has the code for shutting off the spindle and waiting for it to slow down before moving etc. 
I did send them an email to ask them for the code or an example late last night. I am back to work today, so may not get to do much with this today. Maybe tonight if nothing else comes up I will work on it more. Maybe I will get something in the email by then.
I was thinking adding the frequency feedback might open some options for monitoring the speed for some added code abilities. Like I said that got shut down also unless I reduce the signal voltage from the VFD or add an encoder. I am still looking into doing that. I already have the wire ran to send it over to the BoB.
However, you should not really need that to do this. Mach3 didn't need it. I am sure there is a correct code to do it. I just need more time to figure it out or someone else may give me the answer by then. I am sure this has been done many times by people by now surely. It is a pretty basic need for a tool changer I would think.