Hello Guest it is April 23, 2024, 06:59:34 AM

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - dbt3000files

Pages: « 1 2 3 4 5 6 7 »
51
Mach4 General Discussion / Re: macro for Reference All Axes
« on: February 04, 2018, 11:54:52 PM »
Didn't figure out my problem, however you should be able to copy the script of the ref all home button in the wx4 screen.  If you also copy the Ref All Home section of the wx4 screen load script and transfer it to the screen you want to you use, it should work.

I think that there is some issue about putting a homing command in a macro in mach4.  I'm still trying to figure out what that's all about.

52
Mach4 General Discussion / Re: Lua Fails Me
« on: January 19, 2018, 12:45:56 AM »
I may have an answer for you.  I just figured out a similar problem I had on my computer.  I had named a file "write_test" or something, but inside that file I had an old macro function name (M91050) that I forgot to delete, and it screwed everything up until I happened to find it.  Go through all your lua files and look for an m6691 somewhere.
Fingers crossed.

53
Mach4 General Discussion / Re: sms to phone
« on: January 11, 2018, 11:05:45 PM »
Update-
I decided to go ahead and update things to a email-to-sms type system.  Instead of myPhoneNumberHere@vtext.com we use google fi's myPhoneNumberHere@msg.fi.google.com. It's the same thing, and you can get a list of all of the carrier's appropriate email to sms addresses online.

I installed a program called sendEmail from http://caspian.dotconf.net/menu/Software/SendEmail/
This allows you to send an email from the windows command prompt. There are a lot of ways to do this, but this one is very easy.

Here is an example command for the sendEmail program:
c:\your directory\sendEmail.exe -f Sender'sAddress@gmail.com -t YourPhoneNumberHere@msg.fi.google.com -s smtp.gmail.com:587 -xu YourUsername@gmail.com -xp YourPassword -u "test" -m "hello world"

After filling in your individual information, save the command as a .bat file, and then in Lua use:
os.execute("C:\\your directory\\yourtextmessagefile.bat")

This is simpler, freer, and you can also use a regular email address if you don't want it to go to sms. If someone knows how to get it working without using the windows command prompt, then I'm sure that would be a much more elegant solution, but this works great for what I need.



54
Mach4 Videos / Re: Mach4 and Coroutines
« on: January 11, 2018, 06:18:17 PM »
Can't seem to get coroutine working with a macro.  Anything special that needs to be done, or is that not even a thing?

55
Mach4 General Discussion / Re: sms to phone
« on: January 11, 2018, 06:13:52 PM »
We use a pay service called Nexmo.  I believe it is a just a few cents per text but it may have gone up.  If you install a program called cURL, you can access a url through the command line. Nexmo will give you a url to load that will automatically send a text to the number you give them and then you can create a .bat file that looks like this:

cd\your directory
cmd /k curl "https://rest.nexmo.com/sms/json?api_key=**********&api_secret=***********&from=1208675309&to=17208675309&text=hello+world"

We have this running on Mach3 currently, but it should work with lua if you use os.execute like this:

os.execute("C:\\your directory\\yourtextmessagefile.bat")

This works nicely for sending a text once a job is finished. We only have it execute a windows command line after any moving parts have fully stopped.  I don't know how robust Mach4 is, but I don't feel like running a windows command while it is still moving is good practice.

There are definitely ways to do this for free, (probably just sending an email using a .bat file to vtext would work fine) but we pay so little for Nexmo that I haven't gotten around to changing it.

Hope this gives you some ideas!







56
Mach4 General Discussion / macro for Reference All Axes
« on: January 05, 2018, 05:44:14 PM »
I'm having trouble creating a macro that will reliably do the same thing as the "Reference All Axes" button.  The following works every time in the Lua editor:

function reference_all()
    inst = mc.mcGetInstance()
    mc.mcAxisHomeAll(inst)
end

reference_all()

However, if I create following macro it works great in the Lua editor, but when I run it as an m code, nothing happens.

function m91048()
    reference_all()
end

I figure that it has something to do with the "Reference All Axes" button using a coroutine, but I am not sure how to get a macro coroutine to communicate with the plc. (or if that is even the right approach) Just looking for the simplest way to get the m code to work the same way as it does running it from the Lua editor.

Thanks for any help!

p.s.
I will add a little more background information in case it helps.  I am trying to create a homing routine for Clearpath motors that have hardstop homing.  (meaning that you run the axis into a wall and the motor senses the resistance and stops itself) So I am hardstopping the axes, backing off a preset amount and then need to zero all the axes. With Mach4 set to "home in place" G28.1 causes strange and erratic behavior, either crashing Mach4 or wildly jerking the motors, so I need a good alternative.

57
Mach4 General Discussion / Re: script for limit switch override
« on: January 04, 2018, 04:03:55 PM »
Thanks guys!! 
This gives me a lot to go on.

58
Mach4 General Discussion / script for limit switch override
« on: January 02, 2018, 06:12:00 PM »
I am trying to write a lua function for turning on and off limit switch override. (I can provide more details as to why, but it's not important for this post)
I couldn't find anything in the core API help file that came with our copy of mach4.
Any help or suggestions would be great! 
Thanks,
David

59
Thanks for all you guys help!  I think that there probably isn't a way to do what I wanted exactly.  However, I have it set up now to send the machine to where it thinks home should be, use GetOEMLED for my home switch, and if it doesn't return True, then I know something went wrong.  Basically BR549's same idea.
Thanks!

60
Thanks, I think this is the right track but I still can't get it.  I need to run it as part of my program, so I created a macro that looked like this:
DoOEMButton( 119)
DoButton( 26 )

When I ran it, it just toggled off the soft limit and then homed B.  When I tried it without DoOEMButton( 119 ) it homed B and ignored the softlimit until was done homing.
Am I missing something?

Pages: « 1 2 3 4 5 6 7 »