reading Pokeys pins

C Scripting questions and answers
Post Reply
gburk
Old Timer
Posts: 324
Joined: Sun Nov 25, 2018 3:57 pm

reading Pokeys pins

Post by gburk »

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  ???

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

Thanks gary
User avatar
ArtF
Global Moderator
Global Moderator
Posts: 4586
Joined: Sun Sep 05, 2010 6:14 am
Contact:

Re: reading Pokeys pins

Post by ArtF »

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
User avatar
ArtF
Global Moderator
Global Moderator
Posts: 4586
Joined: Sun Sep 05, 2010 6:14 am
Contact:

Re: reading Pokeys pins

Post by ArtF »

Hi Gary:

  The syntax you need is

global ServiceIOPin19 = function()
{
  while(1)
    {
      print("MainPokeysPin19");
      block("MotionPin19");
      //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
MotionPin19. 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
ServiceIOPin19(); 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 controller 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
development 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 frequently 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



gburk
Old Timer
Posts: 324
Joined: Sun Nov 25, 2018 3:57 pm

Re: reading Pokeys pins

Post by gburk »

Thanks Art

I will try it later, I have only on pokeys57cnc..
gburk
Old Timer
Posts: 324
Joined: Sun Nov 25, 2018 3:57 pm

Re: reading Pokeys pins

Post by gburk »

Ok I made the changes to the code as per your suggestion, 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 constantly
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
User avatar
ArtF
Global Moderator
Global Moderator
Posts: 4586
Joined: Sun Sep 05, 2010 6:14 am
Contact:

Re: reading Pokeys pins

Post by ArtF »

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 triggering code to see why it might not answer.

Art


 
gburk
Old Timer
Posts: 324
Joined: Sun Nov 25, 2018 3:57 pm

Re: reading Pokeys pins

Post by gburk »

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 
User avatar
ArtF
Global Moderator
Global Moderator
Posts: 4586
Joined: Sun Sep 05, 2010 6:14 am
Contact:

Re: reading Pokeys pins

Post by ArtF »

Gary:

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

Art
User avatar
ArtF
Global Moderator
Global Moderator
Posts: 4586
Joined: Sun Sep 05, 2010 6:14 am
Contact:

Re: reading Pokeys pins

Post by ArtF »

Gary:

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

Art
gburk
Old Timer
Posts: 324
Joined: Sun Nov 25, 2018 3:57 pm

Re: reading Pokeys pins

Post by gburk »

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  SetStateMask 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
User avatar
ArtF
Global Moderator
Global Moderator
Posts: 4586
Joined: Sun Sep 05, 2010 6:14 am
Contact:

Re: reading Pokeys pins

Post by ArtF »

Hi Gary:

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

Art
User avatar
ArtF
Global Moderator
Global Moderator
Posts: 4586
Joined: Sun Sep 05, 2010 6:14 am
Contact:

Re: reading Pokeys pins

Post by ArtF »

Gary:

  That help file is only complete through the direct Engine commands, its parameters are not entered forthe other groupings. IF you see one of interest
that isnt complete, yell and Ill fill it in. Im looking at completeing 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
User avatar
ArtF
Global Moderator
Global Moderator
Posts: 4586
Joined: Sun Sep 05, 2010 6:14 am
Contact:

Re: reading Pokeys pins

Post by ArtF »

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 instantiate functions and also call them to run at startup
by simply calling the declared function in the library file.

 
Art
gburk
Old Timer
Posts: 324
Joined: Sun Nov 25, 2018 3:57 pm

Re: reading Pokeys pins

Post by gburk »

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.SetStateMask(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
I 
User avatar
ArtF
Global Moderator
Global Moderator
Posts: 4586
Joined: Sun Sep 05, 2010 6:14 am
Contact:

Re: reading Pokeys pins

Post by ArtF »

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 identifier will be shown. In the case of your XhomeTest youll see
a name like LED_USERPANEL_6 or some such thing. Thats the identifier needed for getting an LED hook.

The variable name can be used with variable manipulation routines. As you type the right LED identifier it will
autocorrect in the window your typing it in.

Art


Post Reply

Who is online

Users browsing this forum: No registered users and 4 guests