Led linked to the state of a Physical pin???

More
23 Dec 2014 07:03 #54240 by mmt
I am new to Glade. I have everything working as I would like except the leds.

Can someone show me an example of the code to put in me post-gui.hal file.

Ex. I want led_1 to show the state of parport 1 pin 2 (true-led_1 on....false-led_1 off)

Thanks

Please Log in or Create an account to join the conversation.

More
23 Dec 2014 09:43 - 23 Dec 2014 09:48 #54243 by cmorley
It depends on if the parport pin has a signal connected to it already.

Assuming it doesn't:

net led1_signal parport.1.pin-02-in led_1
Last edit: 23 Dec 2014 09:48 by cmorley. Reason: didnt notice it was parport 1
The following user(s) said Thank You: mmt

Please Log in or Create an account to join the conversation.

More
23 Dec 2014 09:45 #54244 by cmorley
The name of the led will probably actually be gladevcp.led_1 but check to be sure

Please Log in or Create an account to join the conversation.

More
23 Dec 2014 11:33 #54249 by mmt
Thank You that worked perfect

One other question

How do I activate a Led based on the fixture offsett

Ex. I want to have labels G54 G55 G56 etc with led next to each one so that when the offset is active the led is on?

Thanks again
kent

Please Log in or Create an account to join the conversation.

More
23 Dec 2014 14:09 #54253 by cmorley
There is no easy way to do it.
it would require python programming called from the glade panel

Chris M

Please Log in or Create an account to join the conversation.

More
30 Dec 2014 01:50 #54372 by mmt
Thanks for your help Chris.

I do have one problem though. I don't have the physical pin in my main hal file. i simply turn the pin on and off with a M code.

When I add

net led1_signal parport.1.pin-02-in hal_led1

to my custom_postgui.hal file my M code will not function. i.e. change the state of the pin?

Please Log in or Create an account to join the conversation.

More
30 Dec 2014 05:48 #54389 by cmorley
Well the quoted line actually connects the parport pin (driving pin) to the led (driven pin)
It's the parport pin that drives the LED.

Do you want to drive the LED by Mcode too?
Please explain what you are trying to do.

Chris M

Please Log in or Create an account to join the conversation.

More
30 Dec 2014 13:05 - 30 Dec 2014 13:10 #54404 by mmt
Yes I would like it to come on with M101 and go off with M102 if that is possible. ??

M101 turns parport 1 pin 2 true and M102 turns parport 1 pin 2 false.

I was trying to do it with the state of the physical pin but that didn't seem to work the way I am doing it.
Last edit: 30 Dec 2014 13:10 by mmt. Reason: added

Please Log in or Create an account to join the conversation.

More
06 Jan 2015 01:39 #54596 by andypugh

Yes I would like it to come on with M101 and go off with M102 if that is possible. ??

M101 turns parport 1 pin 2 true and M102 turns parport 1 pin 2 false.

I was trying to do it with the state of the physical pin but that didn't seem to work the way I am doing it.


The previous example linked the LED to the state of an _input_ parport pin.

If you want the LED state to echo the status of an _out_ parport pin, then one way to do this is to have HAL:

net theled gladevcp.led_1 parport.0.pin-01-out (or some pin that is an actual output)

Then the M101 bash script can be

halcmd sets theled 1


This sets the -signal- value to 1, and that forces both the LED and the parport pin to 1.

Please Log in or Create an account to join the conversation.

More
06 Jan 2015 02:12 - 06 Jan 2015 02:16 #54602 by mmt
Thanks Andy but I have tried that and still cant get it to work.

I will attach my files here if you could look at them for me.

M Codes are in the next post

File Attachment:

File Name: Control.hal
File Size:5 KB


File Attachment:

File Name: custom_postgui.hal
File Size:0 KB
Attachments:
Last edit: 06 Jan 2015 02:16 by mmt.

Please Log in or Create an account to join the conversation.

Moderators: HansU
Time to create page: 0.101 seconds
Powered by Kunena Forum