I tested without the if pinstate == 1 and I think it may be needed
when I booted auggie I got both printed messages pin 19 changed first then pin 19 check
it didn't matter if the pin was shorted or open same order of messages...
So I think it may be need if I remember correct when I had the pinstate == 1 check it would switch the order of the printed message depending if the pin was shorted or open
Gary
reading Pokeys pins
-
ArtF
- Global Moderator

- Posts: 4557
- Joined: Sun Sep 05, 2010 5:14 pm
- Contact:
Re: reading Pokeys pins
Hi Gary:
I added thius to my motionio library..
global MonitorPin19 = function()
{
while(1)
{
print("Pin 19 Check");
block( "MotionPin19"); //or you cold use IOPin9
//
// when you reach here, its because pin9 has changed..
pinstate = Pokeys1.GetPinDig(19);
print("Pin 19 Changed to state " + pinstate);
}
};
And though I cant yet hook up a pin19 to my system, I did config the pokeys so that pin19 is a digitial output.
I then changed the code in auggie so that as it reads the incoming pin states, it toggles pin19 to 0 as long
as the ctrl key is held, this allowed me to test the script. Its responds properly and shows the message that
the pin has toggled and its state.
Take note though, that youd miss fast presses, this is a slow way to read an input, fine for switches and knobs
but youd never be able to probe with it, probing is a hardwired fucntion due to its complexity and timing
requirments. Ive checked on adding it, but it looks complex enough that I dont think its feasable for the
small amount of people that use auggie or would use it for probing.
Art
I added thius to my motionio library..
global MonitorPin19 = function()
{
while(1)
{
print("Pin 19 Check");
block( "MotionPin19"); //or you cold use IOPin9
//
// when you reach here, its because pin9 has changed..
pinstate = Pokeys1.GetPinDig(19);
print("Pin 19 Changed to state " + pinstate);
}
};
And though I cant yet hook up a pin19 to my system, I did config the pokeys so that pin19 is a digitial output.
I then changed the code in auggie so that as it reads the incoming pin states, it toggles pin19 to 0 as long
as the ctrl key is held, this allowed me to test the script. Its responds properly and shows the message that
the pin has toggled and its state.
Take note though, that youd miss fast presses, this is a slow way to read an input, fine for switches and knobs
but youd never be able to probe with it, probing is a hardwired fucntion due to its complexity and timing
requirments. Ive checked on adding it, but it looks complex enough that I dont think its feasable for the
small amount of people that use auggie or would use it for probing.
Art
-
gburk
- Site Admin
- Posts: 324
- Joined: Mon Nov 26, 2018 2:57 am
Re: reading Pokeys pins
I understand thanks for giving it a shot let me know if anything changed
Gary
Gary
-
gburk
- Site Admin
- Posts: 324
- Joined: Mon Nov 26, 2018 2:57 am
Re: reading Pokeys pins
I see you decided to give probing a try in the new release great...
Have a request to be added if possible as you progress with probing.
I have requested pokeys developers to add some probing return codes for mach4's register's and they have done so not working correct yet but close..
Code that if probe is hit send a say 1 that can be read from a script or to the probe status register or -1 if no probe hit my reason for this is if probing for the center of a block
and you enter a distance that is to small, what I do is use a g31 not a g1 to move the probe down so if the probe returns a -1 I know probe wasn't hit
and then will do the move towards the part, but if I get a value of 1 I know the probe was hit going down and I am not off the block edge and I will send a message
stock size to small enter a lager size retract to start z Hight and back to we probe move x and y started.
I find doing this the probe doesn't crash into the part on the z down move..
make sense?
thanks art
gary
Have a request to be added if possible as you progress with probing.
I have requested pokeys developers to add some probing return codes for mach4's register's and they have done so not working correct yet but close..
Code that if probe is hit send a say 1 that can be read from a script or to the probe status register or -1 if no probe hit my reason for this is if probing for the center of a block
and you enter a distance that is to small, what I do is use a g31 not a g1 to move the probe down so if the probe returns a -1 I know probe wasn't hit
and then will do the move towards the part, but if I get a value of 1 I know the probe was hit going down and I am not off the block edge and I will send a message
stock size to small enter a lager size retract to start z Hight and back to we probe move x and y started.
I find doing this the probe doesn't crash into the part on the z down move..
make sense?
thanks art
gary
-
ArtF
- Global Moderator

- Posts: 4557
- Joined: Sun Sep 05, 2010 5:14 pm
- Contact:
Re: reading Pokeys pins
Gary:
That will be in the next release. After a G31 motion, you will be able to do something
like this..
Engine.GCode("G31Z-20");
h = GlobalGet("Probehit");
if( h )
{
px = GlobalGet("ProbeX"); //etc for each axis you wish to use..
}
The probe hit variable will tell you if the probe actually hit.
It should be possible to easily script a button to do something like
find the center of a hole. I haven't done much testing with scripts
doing repetitive calls as yet, so be cautious about the use of G31,
it should now be safe for zeroing. I already get back a 1 or -1 for
hit or miss I just haven't passed them back to the user yet.
Art
That will be in the next release. After a G31 motion, you will be able to do something
like this..
Engine.GCode("G31Z-20");
h = GlobalGet("Probehit");
if( h )
{
px = GlobalGet("ProbeX"); //etc for each axis you wish to use..
}
The probe hit variable will tell you if the probe actually hit.
It should be possible to easily script a button to do something like
find the center of a hole. I haven't done much testing with scripts
doing repetitive calls as yet, so be cautious about the use of G31,
it should now be safe for zeroing. I already get back a 1 or -1 for
hit or miss I just haven't passed them back to the user yet.
Art
-
gburk
- Site Admin
- Posts: 324
- Joined: Mon Nov 26, 2018 2:57 am
Re: reading Pokeys pins
have you come up with a solution to read the pokeys pin 19?
I tried the code we were working on but still no go to read a probe hit..
thanks gary
I tried the code we were working on but still no go to read a probe hit..
thanks gary
-
ArtF
- Global Moderator

- Posts: 4557
- Joined: Sun Sep 05, 2010 5:14 pm
- Contact:
Re: reading Pokeys pins
Gary:
Im not sure why pin 19 wont trigger as yet for you.
Have you set the probe as pin 19 in the config/planner area?
What then happens if you enter G31Z-10 when Z is zero?
Does it move?
Lets start there to see whats up..
Art
Im not sure why pin 19 wont trigger as yet for you.
Have you set the probe as pin 19 in the config/planner area?
What then happens if you enter G31Z-10 when Z is zero?
Does it move?
Lets start there to see whats up..
Art
-
gburk
- Site Admin
- Posts: 324
- Joined: Mon Nov 26, 2018 2:57 am
Re: reading Pokeys pins
G31Z-10 works started at 0 and went to -10
but not sure on setting pin19
I looked in the auggie configuration but did not see where to set the pins
checked with the pokeys config program and pin 19 is set and does trigger when viewing with their pin monitor
I do have homing working ok with optic sensors and motors moving good
thanks gary
but not sure on setting pin19
I looked in the auggie configuration but did not see where to set the pins
checked with the pokeys config program and pin 19 is set and does trigger when viewing with their pin monitor
I do have homing working ok with optic sensors and motors moving good
thanks gary
-
ArtF
- Global Moderator

- Posts: 4557
- Joined: Sun Sep 05, 2010 5:14 pm
- Contact:
Re: reading Pokeys pins
Gary:
In the config, the one where you set your steps/unit and such. select the
planner page. On that page is a setting for the probe pin selection. There is also
one to select if its a normally closed or open called "Probe Invert".
Set that to pin 19 and see if a G31 responds differently. Try it with probe inverted true and false
the G31 should move in one setting, and not the other. If it seems to probe or not probe
properly, let me know what happens..
Art
In the config, the one where you set your steps/unit and such. select the
planner page. On that page is a setting for the probe pin selection. There is also
one to select if its a normally closed or open called "Probe Invert".
Set that to pin 19 and see if a G31 responds differently. Try it with probe inverted true and false
the G31 should move in one setting, and not the other. If it seems to probe or not probe
properly, let me know what happens..
Art
-
gburk
- Site Admin
- Posts: 324
- Joined: Mon Nov 26, 2018 2:57 am
Re: reading Pokeys pins
Art
Guess I should have put on my glasses found it..
set to pin 19 false g31 z-10 the dro moves to -10 but if I trigger the probe doesn't stop keeps running
set to pin 19 true and I get no dro moment stays at 0,,
I also tried to set metric to false but doesn't seem to set if I close the planer and go reopen it its back to true
thanks gary
Guess I should have put on my glasses found it..
set to pin 19 false g31 z-10 the dro moves to -10 but if I trigger the probe doesn't stop keeps running
set to pin 19 true and I get no dro moment stays at 0,,
I also tried to set metric to false but doesn't seem to set if I close the planer and go reopen it its back to true
thanks gary