indicatorPushButton led hal pin

  • Benb
  • Benb's Avatar Topic Author
  • Offline
  • Premium Member
  • Premium Member
More
04 Jun 2025 01:26 - 04 Jun 2025 02:05 #329645 by Benb
indicatorPushButton led hal pin was created by Benb
indicatorPushButton led does not seem to have an option to connect the led to a hal pin.
Is it possible to add an option to connect the led to a hal pin. Or even better to modify the regular halPushButton to have built in led that connects to a hal pin similar to indicatorPushButton
Thank you

Edit: I am using linuxcnc2.94 rip, debian bookworm, linux kernel 12.12 rt
Last edit: 04 Jun 2025 02:05 by Benb.

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

More
04 Jun 2025 03:00 #329649 by cmorley
Replied by cmorley on topic indicatorPushButton led hal pin
HAL Widget PushButton can have a LED controlled by a HAL pin.
Actually IndicatedPushButton can too, it just doesn't have the HAL pin controlled by the button.

 

Chris
Attachments:

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

  • Benb
  • Benb's Avatar Topic Author
  • Offline
  • Premium Member
  • Premium Member
More
04 Jun 2025 03:51 #329651 by Benb
Replied by Benb on topic indicatorPushButton led hal pin
Chris thank you very much for the quick response. Indeed hal pushbutton has built in led (I missed that part my appologies)

Now, where do I entre the name of the led to be able to turn on/off the led with a hal pin

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

More
04 Jun 2025 12:47 #329683 by cmorley
Replied by cmorley on topic indicatorPushButton led hal pin
The led name will be the button name with '-led' on the end.
in the above example the pin name would be 'SCREENNAME.mybutton-led'

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

  • Benb
  • Benb's Avatar Topic Author
  • Offline
  • Premium Member
  • Premium Member
More
04 Jun 2025 18:15 #329709 by Benb
Replied by Benb on topic indicatorPushButton led hal pin
Chris it worked ,thank you for your guidance.
For those learning to use qtvcp with hal, here is "Hello World"  example that turns on/off the embedded led in hal PushButton widget.

Start Qt Designer:
For a RIP install:
  Open a terminal and source the environment:
  $ source /home/YourPath/scripts/rip-environment
  $ designer -qt=5
For a package install:
  Open a terminal and type:
  $ designer -qt=5
Create MainWindow Widget
  Select MainWindow
Add the ScreenOptions Widget
  Drag and drop the ScreenOptions widget anywhere onto the MainWwindow widget
Add hal PushButton
  Drag and drop hal PushButton widget anywhere onto the MainWwindow widget
Save The .ui File
  Save the file as test.ui in a folder
Create a .hal file
  Open text editor and copy hal netlisting (see below), save the file as test.hal
  (make sure you save .hal file .ui file in the same folder)
At command prompt:
 $ halrun -I -f test.hal

Copy following into text file and save as  test.hal
# load realtime components
# load non-realtime programs
loadusr -Wn test qtvcp test.ui
# add components to thread
# connect pins
net connect test.mybutton test.mybutton-led 
# start thread
start

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

Moderators: cmorley
Time to create page: 0.104 seconds
Powered by Kunena Forum