Page 2 of 59
Re: reading Pokeys pins
Posted: Thu Nov 29, 2018 1:36 pm
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
Re: reading Pokeys pins
Posted: Thu Nov 29, 2018 1:42 pm
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
Re: reading Pokeys pins
Posted: Thu Nov 29, 2018 1:48 pm
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
Re: reading Pokeys pins
Posted: Thu Nov 29, 2018 6:07 pm
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
Re: reading Pokeys pins
Posted: Fri Nov 30, 2018 12:37 pm
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
Re: reading Pokeys pins
Posted: Fri Nov 30, 2018 7:25 pm
by gburk
I guess I'm to old for this but any way I started the script edit and when I right clicked the led I got
Main_LED_0:XhomeTest
I got the same type of name on all the led's, but the buttons did look like I was getting the right names back
Thanks gary
Re: reading Pokeys pins
Posted: Fri Nov 30, 2018 8:40 pm
by ArtF
Gary:
SO to connect to that LED youd use
the name Main_LED_0 ,
led = Led("Main_LED_0");
led.SetStateMask(1);
the variable name is XHomeTest. Not all items have a variable name.
I think the statement XHomeTest = 1 shoud turn it on as well without
having to get an LED hook for it. Generally a variable named object can
be refered to in script by its variable name instead of getting a hook and
using that. Ill have to test thats true in the case of LED's, its been awhile
since Ive done screen edits.
Art
Re: reading Pokeys pins
Posted: Fri Nov 30, 2018 8:49 pm
by ArtF
Hi Gary:
I went back and edited to refresh myslf on how it works.
To set or get and LED's value, if it has a variable name, you can use
x = GlobalGet("MotionConnected");
print("Led = " + x);
GlobalSet("MotionConnected",1);
This will show you the motionconnected LED and set it to on if your in sim, replace
its varaible name with any you use and the globalGet / GlobalSet should work for you
for getting and settign any variable.
Art
Re: reading Pokeys pins
Posted: Sat Dec 01, 2018 1:19 am
by gburk
Ill try it I was confused as to how it knows which led is ("Main_LED_0"); all the leds on the main screen had the same name except the :XhomeText The Estop led had Main_LED_ 0:Estop
Thanks gary
Re: reading Pokeys pins
Posted: Sat Dec 01, 2018 4:14 am
by ArtF
Gary:
While normally all LEDs will have names that are different, when the system see's they have a variable name,
it doesnt try to rename them to different primary names. this has to do with the rather complex system of naming
which is necessary as various modules could share a led name internally. At startup various id's are checkled in
order and apparently it ignores the naming once it see's it has a variable name instead. (Its been awhile since
Ive been in there..).
I tested the script I posted, should work OK.. Still dont know why the block didnt work, more testing req
Art