//Set mist/flood control
//1 = mist, 2 = flood, 0 = off
global SetMistFlood = function( relayNumber )
{
//Relay # 1-4
//print("Flood change");
OnOrOff = MyMotion.GetRelay(relayNumber);
if (OnOrOff == 0)
{
MyMotion.SetRelay(relayNumber,1);
print("M8 Flood Relay Turned ON");
GlobalSet("FloodOnLED",1);
}
else
{
MyMotion.SetRelay(relayNumber,0);
print("M9 Flood Relay Turned OFF");
GlobalSet("FloodOnLED",0);
}
};
If I call m8 the relay go's on, if I call m9 the relay stays on but it does do the print M9 flood relay turner off, if I call m8 a second time the relay turns off ok..
I will check to see if the led is set to flashing..
Thanks gary
reading Pokeys pins
-
ArtF
- Global Moderator

- Posts: 4557
- Joined: Sun Sep 05, 2010 5:14 pm
- Contact:
Re: reading Pokeys pins
Gary:
I believe the function gets a 0,1, or 2 in the parameters to indicate if this is an M7,m8 or M9. They way the commands for mist,flood work
is SetMistFlood(0) shoudl turn on whatever relay mist is contolling, a 1 to turn on the flood relay and a m9 to turn them both off.
Various machines use various logic for this , my script dopesnt actually use mist,flood but Id think its more..
//Set mist/flood control
//1 = mist, 2 = flood, 0 = off
global SetMistFl ood = function( desiredstate )
{
MistRelay = 1;
FloodRelay = 2;
if (desiredstate == 0) //mist
{
MyMotion. SetRelay(MistRelay,1);
print("M7 Mist Relay Turned ON");
GlobalSet("FloodOnLED",1);
}
if (desiredstate == 1) //flood
{
MyMotion. SetRelay(FloodRelay,1);
print("M8 Flood Relay Turned ON");
GlobalSet("FloodOnLED",1);
}
if (desiredstate == 2) //flood,mist off
{
MyMotion. SetRelay(MistRelay,0);
MyMotion. SetRelay(FloodRelay,0);
print("M9 Flood and Mist Relays Turned ON");
GlobalSet("FloodOnLED",0);
GlobalSet("MistOnLED",0);
}
};
Art
I believe the function gets a 0,1, or 2 in the parameters to indicate if this is an M7,m8 or M9. They way the commands for mist,flood work
is SetMistFlood(0) shoudl turn on whatever relay mist is contolling, a 1 to turn on the flood relay and a m9 to turn them both off.
Various machines use various logic for this , my script dopesnt actually use mist,flood but Id think its more..
//Set mist/flood control
//1 = mist, 2 = flood, 0 = off
global SetMistFl ood = function( desiredstate )
{
MistRelay = 1;
FloodRelay = 2;
if (desiredstate == 0) //mist
{
MyMotion. SetRelay(MistRelay,1);
print("M7 Mist Relay Turned ON");
GlobalSet("FloodOnLED",1);
}
if (desiredstate == 1) //flood
{
MyMotion. SetRelay(FloodRelay,1);
print("M8 Flood Relay Turned ON");
GlobalSet("FloodOnLED",1);
}
if (desiredstate == 2) //flood,mist off
{
MyMotion. SetRelay(MistRelay,0);
MyMotion. SetRelay(FloodRelay,0);
print("M9 Flood and Mist Relays Turned ON");
GlobalSet("FloodOnLED",0);
GlobalSet("MistOnLED",0);
}
};
Art
-
gburk
- Site Admin
- Posts: 324
- Joined: Mon Nov 26, 2018 2:57 am
Re: reading Pokeys pins
Ok thanks will try it out
Here is a script to read pin19 doesn't work
global MyMotion = Motion(); //Will not exist unless lib is loaded
global MonitorPin19 = function()
{
while(1)
{
print("Pin 19 Check");
block( "MotionPiin19"); //pokeys57 Pin19
//
// when you reach here, its because pin9 has changed..
pinstate = MyMotion.GetPinDig (19);
if( pinstate == 1 )
{
print("Pin 19 Changed");
//do what you need to do. Take not that if you change pin9, youll get called again..
//so make sure you dont get into a loop where your change makes this gets called which then changes it..etc.. .
}
}
};
MonitorPin19();
prints the first print statement but never seems to read the pin when hit so never get the pin 19 changed message..
You were right the led in the homing was set to blink so fixed now...
Thanks gary
Here is a script to read pin19 doesn't work
global MyMotion = Motion(); //Will not exist unless lib is loaded
global MonitorPin19 = function()
{
while(1)
{
print("Pin 19 Check");
block( "MotionPiin19"); //pokeys57 Pin19
//
// when you reach here, its because pin9 has changed..
pinstate = MyMotion.GetPinDig (19);
if( pinstate == 1 )
{
print("Pin 19 Changed");
//do what you need to do. Take not that if you change pin9, youll get called again..
//so make sure you dont get into a loop where your change makes this gets called which then changes it..etc.. .
}
}
};
MonitorPin19();
prints the first print statement but never seems to read the pin when hit so never get the pin 19 changed message..
You were right the led in the homing was set to blink so fixed now...
Thanks gary
-
gburk
- Site Admin
- Posts: 324
- Joined: Mon Nov 26, 2018 2:57 am
Re: reading Pokeys pins
Art
Tried the relays as your post but doesn't work,
m8 I get nothing no relays on and no printed message
m7 I get the printed message but no relays on
M9 I get the printed message but there isn't any relays on so don't know it that will turn them off..
in the script I first sent the relays did go on and off...
Not sure what the major change would have been to effect that..
Thanks gary
Tried the relays as your post but doesn't work,
m8 I get nothing no relays on and no printed message
m7 I get the printed message but no relays on
M9 I get the printed message but there isn't any relays on so don't know it that will turn them off..
in the script I first sent the relays did go on and off...
Not sure what the major change would have been to effect that..
Thanks gary
-
gburk
- Site Admin
- Posts: 324
- Joined: Mon Nov 26, 2018 2:57 am
Re: reading Pokeys pins
I printer out the (desiredstate)
and I get 3 when m8 is run
and also when I run m9 it seen to run twice first its = to 2 then it must run a second time and it = to 0;;
make sense?
But the relays still don't turn on makes no sense to me using the same MyMotion.SetRelay(MistRelay,1); command as the script I sent you
and mine turns them on and off... as far as I can tell the only difference is in mine its using the m8 as the relay number and looks like to # 3
so its sending #3 as the relay #
in your script its using 1 and 2..
//Set mist/flood control
//1 = mist m7, 3 = flood m8, 2 and 0 = off m9
global SetMistFlood = function( desiredstate )
{
print("M Number = ",desiredstate);
MistRelay = 1;
FloodRelay = 2;
if (desiredstate == 1) //mist
{
MyMotion.SetRelay(MistRelay,1);
print("M7 Mist Relay Turned ON");
GlobalSet("FloodOnLED",1);
}
if (desiredstate == 3) //flood
{
MyMotion.SetRelay(FloodRelay,1);
print("M8 Flood Relay Turned ON");
GlobalSet("FloodOnLED",1);
}
if (desiredstate == 2) //flood,mist off
{
MyMotion.SetRelay(MistRelay,0);
MyMotion.SetRelay(FloodRelay,0);
print("M9 Flood and Mist Relays Turned OFF");
GlobalSet("FloodOnLED",0);
//GlobalSet("MistOnLED",0);
}
};
and I get 3 when m8 is run
and also when I run m9 it seen to run twice first its = to 2 then it must run a second time and it = to 0;;
make sense?
But the relays still don't turn on makes no sense to me using the same MyMotion.SetRelay(MistRelay,1); command as the script I sent you
and mine turns them on and off... as far as I can tell the only difference is in mine its using the m8 as the relay number and looks like to # 3
so its sending #3 as the relay #
in your script its using 1 and 2..
//Set mist/flood control
//1 = mist m7, 3 = flood m8, 2 and 0 = off m9
global SetMistFlood = function( desiredstate )
{
print("M Number = ",desiredstate);
MistRelay = 1;
FloodRelay = 2;
if (desiredstate == 1) //mist
{
MyMotion.SetRelay(MistRelay,1);
print("M7 Mist Relay Turned ON");
GlobalSet("FloodOnLED",1);
}
if (desiredstate == 3) //flood
{
MyMotion.SetRelay(FloodRelay,1);
print("M8 Flood Relay Turned ON");
GlobalSet("FloodOnLED",1);
}
if (desiredstate == 2) //flood,mist off
{
MyMotion.SetRelay(MistRelay,0);
MyMotion.SetRelay(FloodRelay,0);
print("M9 Flood and Mist Relays Turned OFF");
GlobalSet("FloodOnLED",0);
//GlobalSet("MistOnLED",0);
}
};
-
ArtF
- Global Moderator

- Posts: 4557
- Joined: Sun Sep 05, 2010 5:14 pm
- Contact:
Re: reading Pokeys pins
Hi Gary:
I think we may be using differernt versions, I just refreshed the download to be sure so please reinstall auggie. If you changed
and screens but didnt rename them, do that first as it will overwrite changes you made to my screens.
Hers is the script I just tested as working, But read on after..
global SetMistFlood = function( state )
{
//1 = CW, 2 = CCW, 0 = off
if( state == 0)
{
Pokeys1.SetRelay(1,0);
Pokeys1.SetRelay(2,0);
}
if( state == 1)
{
Pokeys1.SetRelay( 1,1 );
}
if( state == 2)
{
Pokeys1.SetRelay( 2,1 );
}
print( "flood/mist state: " + state );
};
The relays in a pokeys arent in bit order, so auggie sees them as different numbers.
auggies Relay 1 is Pokeys OC2
Relay 2 is Pokeys OC1
Relay 3 is Pokeys hard relay 1
Relay 4 is Pokeys hard relay 2
Now this script assumes a relay for mist, one for flood and turns them both off on m9. This is conventional with
some cnc systems where one relay turns on the mist pump, and the second speeds it up. M9 then turns off both relays.
I jst tested this and it seems to work fine.
Art
I think we may be using differernt versions, I just refreshed the download to be sure so please reinstall auggie. If you changed
and screens but didnt rename them, do that first as it will overwrite changes you made to my screens.
Hers is the script I just tested as working, But read on after..
global SetMistFlood = function( state )
{
//1 = CW, 2 = CCW, 0 = off
if( state == 0)
{
Pokeys1.SetRelay(1,0);
Pokeys1.SetRelay(2,0);
}
if( state == 1)
{
Pokeys1.SetRelay( 1,1 );
}
if( state == 2)
{
Pokeys1.SetRelay( 2,1 );
}
print( "flood/mist state: " + state );
};
The relays in a pokeys arent in bit order, so auggie sees them as different numbers.
auggies Relay 1 is Pokeys OC2
Relay 2 is Pokeys OC1
Relay 3 is Pokeys hard relay 1
Relay 4 is Pokeys hard relay 2
Now this script assumes a relay for mist, one for flood and turns them both off on m9. This is conventional with
some cnc systems where one relay turns on the mist pump, and the second speeds it up. M9 then turns off both relays.
I jst tested this and it seems to work fine.
Art
-
gburk
- Site Admin
- Posts: 324
- Joined: Mon Nov 26, 2018 2:57 am
Re: reading Pokeys pins
That works now had a different version of auggie
do you think reading the pins may work now also, haven't tried that yet with this version..
Thanks gary
do you think reading the pins may work now also, haven't tried that yet with this version..
Thanks gary
-
gburk
- Site Admin
- Posts: 324
- Joined: Mon Nov 26, 2018 2:57 am
Re: reading Pokeys pins
nope pin state never seems to change
when first run it prints pin 19 check
but never seems to change the pinstate
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);
if( pinstate == 1 )
{
print("Pin 19 Changed");
//do what you need to do. Take not that if you change pin9, youll get called again..
//so make sure you dont get into a loop where your change makes this gets called which then changes it..etc.. .
}
}
};
MonitorPin19();
Thanks gary
when first run it prints pin 19 check
but never seems to change the pinstate
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);
if( pinstate == 1 )
{
print("Pin 19 Changed");
//do what you need to do. Take not that if you change pin9, youll get called again..
//so make sure you dont get into a loop where your change makes this gets called which then changes it..etc.. .
}
}
};
MonitorPin19();
Thanks gary
-
gburk
- Site Admin
- Posts: 324
- Joined: Mon Nov 26, 2018 2:57 am
Re: reading Pokeys pins
sorry for all the messages
It almost seems like once auggie is booted it checks the pin 19 script then and not again...
this is what I have found I boot auggie pin 19 not shorted I get the message pin 19 change then pin 19 checked
if I boot auggie with pin 19 shorted I only get the message pin 19 checked
after the initial booting of auggie and received the message at boot
that's the end doesn't see a short or no short almost seems like its not running after auggies first boot
Gary
It almost seems like once auggie is booted it checks the pin 19 script then and not again...
this is what I have found I boot auggie pin 19 not shorted I get the message pin 19 change then pin 19 checked
if I boot auggie with pin 19 shorted I only get the message pin 19 checked
after the initial booting of auggie and received the message at boot
that's the end doesn't see a short or no short almost seems like its not running after auggies first boot
Gary
-
ArtF
- Global Moderator

- Posts: 4557
- Joined: Sun Sep 05, 2010 5:14 pm
- Contact:
Re: reading Pokeys pins
Hmm..
Does sound like a script that is stopping. The script you have shoudl be
global MonitorPi n19 = function()
{
while(1)
{
print("Pin 19 Check");
block( "MotionPin 19"); //or you cold use IOPin9
//
// when you reach here, its because pin9 has changed..
pinstate = Pokeys1.G etPinDig(19);
print("Pin 19 Changed");
//do what you need to do. Take not that if you change pin9, youll get called again..
//so make sure you dont get into a loop where your change makes this gets called which then changes it..etc.. .
}
};
Probably wont make a difference, but the == 1 is nbot needed to check for a change. So long as the block is signaled, you should
get a message. Ive been fighting some hardware issues, but Ill see if tomorrow I can find out why it may only run the once..
Art
Does sound like a script that is stopping. The script you have shoudl be
global MonitorPi n19 = function()
{
while(1)
{
print("Pin 19 Check");
block( "MotionPin 19"); //or you cold use IOPin9
//
// when you reach here, its because pin9 has changed..
pinstate = Pokeys1.G etPinDig(19);
print("Pin 19 Changed");
//do what you need to do. Take not that if you change pin9, youll get called again..
//so make sure you dont get into a loop where your change makes this gets called which then changes it..etc.. .
}
};
Probably wont make a difference, but the == 1 is nbot needed to check for a change. So long as the block is signaled, you should
get a message. Ive been fighting some hardware issues, but Ill see if tomorrow I can find out why it may only run the once..
Art