Page 2 of 3

Re: Script+Pokeys

Posted: Mon Aug 08, 2016 2:29 am
by satco
Hi Art,
I test following:

pinstate = Pokeys1.GetPinDig(9);
if( pinstate == 1 )
    {
  print("pinstate"+1);
    }
else
{
print("pinstate"+0);
}

It works good. Then I test:

global  MonitorPin9 = function()
{
  while(1)
  {
    block( "MotionPin9");
    pinstate = Pokeys1.GetPinDig(9);
    if( pinstate == 1 )
    {
  print(" pinstate");
    }
  }
};
MonitorPin9();

I have no reaction on Pin9 changes. Where is error? The same result with "IOPin9".

Best regards,
Anatolii.

Re: Script+Pokeys

Posted: Mon Aug 08, 2016 3:52 am
by ArtF
Anatolii:

Hmm, I just tried this in the script window as a test..

block("MotionPin1");
print("Done");


  Run that script and the script light should stay flashing. Its waiting on the block.
When I jumper pin1 to ground, the word done is printed in the log and the light stops flashing.

Can you try that test for me? Seems to work here, the block gets released if I go from 1 to 0 or 0 to 1..

Thx
Art

Re: Script+Pokeys

Posted: Mon Aug 08, 2016 7:27 pm
by satco
Hi Art,

I set "NO" button among Pin1 and GND. In NO condition Pin1 hase 3.7V. In NC Pin1 hase 0V.

I have tested:
block("MotionPin1");
print("Done"+Pokeys1.GetPinDig(11));


I push Button to NC and wait in this condition. The word "Done0" is printed in the log and the light stops flashing.
So the block gets released if I go from 1 to 0.

My mistake is I try to set blok to Pin9. Pin9 in my Hard is DigOut :)

Best regards,
Anatolii.

Re: Script+Pokeys

Posted: Tue Aug 09, 2016 12:28 am
by ArtF
Anatolii:

lol, makes sense. I do such things as well. Glad to hear it works. You can also block on multiple options if you like.. for example...


myblock = block( "MotionPin9" , "IOPin9", "MotionPin11");

if( myblock == "MotionPin9" ) { .......do whateer" };

etc..

  Just so you ( and anyone else working with blocks.. ) knows.

  This makes it possible to write one script that monitors and deals efficiently with multiple pins.
This can save a lot of scripting in multiple scripts. Its unknown how many you can run simultaneously..
Ive run up to 50 scripts at once while Gcode runs as a test, but Im assuming this depends on CPU
power and your system. Not many people run Auggie , so it will take awhile for limitations to be
figured out fully. All I know is it runs my laser pretty good. :)

Art


Re: Script+Pokeys

Posted: Tue Aug 09, 2016 3:11 am
by satco
Hi Art,

Auggie like a sleeping Dragon. I will be very glad to help you wake him up. If I can to test or make  anything else, let me know please.

Is it possible to block an Analog Input. If input signal change - start script? It will be a very powerful tool to work with analog signals.

Best regards,
Anatolii.

Re: Script+Pokeys

Posted: Tue Aug 09, 2016 3:50 am
by ArtF
Hi A:

  It isnt really possible to block on an analogue because I havent set any way to set a range.
Ask me about this in the fall, if I add a couple calls to set a blocking range, it owuld be possible
to block on signal change of more than a set tolerance.Analogues tend to swing, so I was worried abotu too many block calls.

Thx

Art

Re: Script+Pokeys

Posted: Tue Aug 09, 2016 6:10 am
by satco
Hi Art,

Ok, I test block and waiting fall.

Best regards,
Anatolii.