GPIO control
01 Jun 2023 18:44 #272651
by vedatech
GPIO control was created by vedatech
How can I set a GPIO output with a QTvcp button or check box? (I'm using a modified version of QTaxis with qtdesigner)
For instance in .hal I have "hm2_5i25.0.gpio.025.is_output TRUE" and the pin is wired to a power relay but I can't find a way to set it.
For instance in .hal I have "hm2_5i25.0.gpio.025.is_output TRUE" and the pin is wired to a power relay but I can't find a way to set it.
Please Log in or Create an account to join the conversation.
01 Jun 2023 21:53 #272657
by persei8
Replied by persei8 on topic GPIO control
If you select the Linuxcnc Pushbutton widget in designer, qtvcp makes a HAL pin for it that you then connect to your gpio in the post_gui.hal file.
This is not QPushbutton but Pushbutton under the Linuxcnc section. For example, in Qtdragon, I have buttons to turn on relays for a water pump and laser crosshair. The commands in qtdragon_postgui.hal are:Of course, you need to make adjustments for the names to suit your 5i25 board.
Jim
This is not QPushbutton but Pushbutton under the Linuxcnc section. For example, in Qtdragon, I have buttons to turn on relays for a water pump and laser crosshair. The commands in qtdragon_postgui.hal are:
net flood_ouput iocontrol.0.coolant-flood => hm2_7i96.0.ssr.out-01
net laser_on qtdragon.btn_laser_on => hm2_7i96.0.ssr.out-03
Jim
Please Log in or Create an account to join the conversation.
02 Jun 2023 01:31 #272665
by vedatech
Replied by vedatech on topic GPIO control
Thanks persei8, I did try adding Linuxcnc pushbutton but I didn't connect it in the postgui.hal file. I'll give that a shot as soon as I have time.
Please Log in or Create an account to join the conversation.
02 Jun 2023 01:34 #272666
by cmorley
Replied by cmorley on topic GPIO control
Jim's suggestion is the most user friendly if you later need to change the pin name, but you can also use the pushbutton to call a function in the handler file or call a python command directly. Either of those could use HAL python module to set pins/params.
in a handler file:
self.h.hal.set_p("pinname","10")
in designer button python command:
HAL.set_p('motion.probe-input','1')
in a handler file:
self.h.hal.set_p("pinname","10")
in designer button python command:
HAL.set_p('motion.probe-input','1')
Please Log in or Create an account to join the conversation.
02 Jun 2023 14:14 #272723
by vedatech
Replied by vedatech on topic GPIO control
Thanks persei8, works like a charm. I didn't realize that:
1. pin names in the button widget are created a startup
2. the new pins must be prefixed by the gui name (<name>.ui) when referenced in
postgui.hal (but not when referenced by other QT widgets)
I didn't see this in the documentation.
Problem solved.
1. pin names in the button widget are created a startup
2. the new pins must be prefixed by the gui name (<name>.ui) when referenced in
postgui.hal (but not when referenced by other QT widgets)
I didn't see this in the documentation.
Problem solved.
Please Log in or Create an account to join the conversation.
Moderators: cmorley
Time to create page: 0.088 seconds