GearHeads Corner
October 19, 2019, 08:09:39 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
 
   Home   Help Search Login Register  
Pages: [1] 2 3 ... 33
  Print  
Author Topic: reading Pokeys pins  (Read 10455 times)
0 Members and 1 Guest are viewing this topic.
gburk
Sr. Member
****
Posts: 258


View Profile
« on: November 27, 2018, 09:00:43 PM »

I put this in a new library I know I am doing a lot wrong don't seem to be able to trigger the pin when I trigger it with my switch i'm sure its being triggered
I have other software that is reading it correct high or low..

so far the only script I have had any luck with is putting a button on screen and getting it to print when pressed but I assume it because the script is in the screen script
and not the library.

How far off am I  Huh

global ServiceIO Pin19 = function()
{
  while(1)
    {
       print("IoPin19");
       block("IOPin19");
       //do what you wish to happen
       // on pin19 change here.
    }
};

Thanks gary
Logged
ArtF
Administrator
Hero Member
*****
Posts: 5410



View Profile
« Reply #1 on: November 27, 2018, 09:13:50 PM »

Hi Gary:

 Ill look this up in the morning and show you how to do what I think
your trying to do. Do you have 2 pokeys, a master and an IO one, or just one
pokeys and your trying to trigger on its pin19?

Art
Logged
ArtF
Administrator
Hero Member
*****
Posts: 5410



View Profile
« Reply #2 on: November 28, 2018, 09:49:21 AM »

Hi Gary:

  The syntax you need is

global ServiceIO Pin19 = function()
{
  while(1)
    {
       print("MainPokey sPin19");
       block("MotionPin 19");
       //do what you wish to happen
       // on pin19 change here.
    }
};



   You have it correct except that Auggie will control up to
two Pokeys at once. The main pokeys is a 57CNC type,
while the IO pokeys can be almost any type. So to block
 on the 2nd pokeys is your original code, while the main one is called with
MotionPin 19. The two pokeys are refered to as Motion and IO.

 The above script will block on pin19
of the 57cnc.

  Also, if you add this script to the GCode library for example,
you should call it in the library at the end with
ServiceIO Pin19(); to start it up as the library is added.

  Im still looking into the question of probing for you. When I wrote
Auggie it was with the intent of creating a cnc controlle r of
basic abilities which is why I didnt add threading or probing,
while the code exists for both in the engine, I knew from Mach3's
developme nt that few used probeing or threading and they tended
to create the most support, so for Auggie I didnt support the more
obscure functions that caused all the tech support.

  Auggie is pretty powerful for laser as I use it frequentl y for that myself,
and its pretty good at general things in cnc, but I tend to use
Mach3 myself for milling, though a special copy of my own design.

  It may , however, be possible to give access to the probing calls
via script, if I can do that I will turn on an interface for it, and then the G31
command could be scripted to do a probe. Any GCode not handled by Auggie
will elicit a call to a Script under that Gcodes number. For example, as
Auggie has no internal hook for G31, it will at the right time in the code
call for a script called "GCode31", and if the GCode library has such a
named function it will be executed.

  So Ill check to see if I can do that this week, its all a question of
how much code would be required to give access to that function
as Im deeply into some pwm work to enhance laser engraving

Thx
Art



 
Logged
gburk
Sr. Member
****
Posts: 258


View Profile
« Reply #3 on: November 28, 2018, 10:34:12 AM »

Thanks Art

I will try it later, I have only on pokeys57c nc..
Logged
gburk
Sr. Member
****
Posts: 258


View Profile
« Reply #4 on: November 28, 2018, 03:07:02 PM »

Ok I made the changes to the code as per your suggestio n, but doesn't seem to trigger the pin or at least see it being triggered, I don't get the printed message displayed from the code.

I did create a library folder called pokeys57 and added the script to that library also have it turned on and checked
you said maybe put it in the gcode library does it need to be there ?.

or could I be missing something else.

tested the pin in mach3 and mach4 today and both read the pin so I sending the signal correctly .

also some times when I boot auggie  it asks if I want to use pokeys config or auggies I have been choosing pokeys..

Im supprised no one has asked for probing but I guess auggie is mostly for laser and I mostly use the mill...
I have problems with pokeys and mach3 probing no matter what I change in the config the probe led flashes on and off looks like a false trigger constantl y
if I invert the pin the led stays on but on flashing but mach3 thinks its triggered ...
Mach4 seems to read it ok no flashing but I don't have mach4 on the mill's computer. 
and I like the scripting better in auggie not a fan of lua…

Thanks gary
Logged
ArtF
Administrator
Hero Member
*****
Posts: 5410



View Profile
« Reply #5 on: November 28, 2018, 03:33:53 PM »

Gary

 
I talked to Mat, the pokeys firmware author and he tells me its a normal buffered waypoint move
that I set to a probeing state to make probeing work, Ill take a look at it. The pokeys stops motion
and switches to internal; planner waiting for the trigger point to be read.

  Your script shouldnt have to be in the Gcode library, can be in any. If you run it from
the script window does the script running led flash showing one is running? Ill take a look at the
block triggerin g code to see why it might not answer.

Art
 

   
Logged
gburk
Sr. Member
****
Posts: 258


View Profile
« Reply #6 on: November 28, 2018, 05:59:08 PM »

Not sure which led but when I run it in the script window I get the message  end of mdi script run no led's flashing

also having jog problems now only will jog one direction and only .010 distance can't jog past that.. or the other direction .

also do you have it setup to read the homing pins or will that also need to be done with a script?.. haven't got that far yet so going to ask before I start on the homing..

Thanks gary 
Logged
ArtF
Administrator
Hero Member
*****
Posts: 5410



View Profile
« Reply #7 on: November 28, 2018, 08:35:22 PM »

Gary:

 Homing should work fine. Also, turn off softlimit s, it may be those that are affecting you, until homing is setup, turn off softlimit s in the config.
That will probably fix your jogging.

Art
Logged
ArtF
Administrator
Hero Member
*****
Posts: 5410



View Profile
« Reply #8 on: November 28, 2018, 08:36:46 PM »

Gary:

  Test homing in the pokeys setup program, it should work there, if so it should work in Auggie.  I use
it daily.

Art
Logged
gburk
Sr. Member
****
Posts: 258


View Profile
« Reply #9 on: November 29, 2018, 08:12:31 AM »

homing pins are showing being triggered in pokeys...

I have been looking for a doc file to show how dome of the build in commands are used haven't found one the file in the auggie folder shows the calls but not how to use them
like what they may need to be passed to then or read from them say like  SetStateM ask that's all that's in the doc file but not what to pass to it like maybe the led variable name
and a value to set it just an example, is there a doc file with how values need to be passed and read from the built in functions?

Thanks gary
Logged
ArtF
Administrator
Hero Member
*****
Posts: 5410



View Profile
« Reply #10 on: November 29, 2018, 08:36:57 AM »

Hi Gary:

 Check the AuggiePro grammersG uide.chm file in your folder. It shows erxamples of all the script calls and hwo they are
used in general.

Art
Logged
ArtF
Administrator
Hero Member
*****
Posts: 5410



View Profile
« Reply #11 on: November 29, 2018, 08:42:57 AM »

Gary:

  That help file is only complete through the direct Engine commands, its parameter s are not entered forthe other groupings . IF you see one of interest
that isnt complete, yell and Ill fill it in. Im looking at completei ng that list and removing obsolete groups such as the contour drawing groups and such.
Too much was added into auggie that it didnt need, so much is being removed.

Art
Logged
ArtF
Administrator
Hero Member
*****
Posts: 5410



View Profile
« Reply #12 on: November 29, 2018, 08:48:20 AM »

Gary:

  One final thought, make sure you read the code contained in the default libraries, they are the best example of how
to use the various calls. Most of them are used in one way or another in the examples shown. You get a pretty good
idea how to script from those scripts. You can see some of them instantia te functions and also call them to run at startup
by simply calling the declared function in the library file.

   
Art
Logged
gburk
Sr. Member
****
Posts: 258


View Profile
« Reply #13 on: November 29, 2018, 01:07:29 PM »

Ok did a button to call this script

The Word help prints to the screen but the led doesn't turn on.

I created a led with the var name to XhomeTest

global Main_BUT_ 20 = function( current )
 {
 print("Help");
 led = Led("XhomeTest");
  led.SetSt ateMask(1);
  //sleep(30);
  //led.SetStateMask(0);  //this makes the LED turn off, then on again in 3 seconds.

 return;
 };

So doing something wrong sorry for all the questions once I wrap my head around this stuff I should be good to go..
I didn't see anything like this in the scripts in the script folder...

Thanks gary
Logged
ArtF
Administrator
Hero Member
*****
Posts: 5410



View Profile
« Reply #14 on: November 30, 2018, 07:37:34 AM »

Hi Gary:

    Your problem is the name of the led, your using the led variable name , not the actual led id name.
Start the scripter with the scripter checkbox in config dropdown. Turn on the scripter with its power button.

  At this point you can right click any LED and its identifie r will be shown. In the case of your XhomeTest youll see
a name like LED_USERP ANEL_6 or some such thing. Thats the identifie r needed for getting an LED hook.

 The variable name can be used with variable manipulat ion routines. As you type the right LED identifie r it will
autocorre ct in the window your typing it in.

Art


Logged
Pages: [1] 2 3 ... 33
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.11 | SMF © 2006-2009, Simple Machines LLC Valid XHTML 1.0! Valid CSS!