Import pin value in handler.py
- TMinj
- Offline
- New Member
-
Less
More
- Posts: 2
- Thank you received: 0
01 Jul 2025 20:06 - 01 Jul 2025 20:10 #331079
by TMinj
Import pin value in handler.py was created by TMinj
Hello,
I'm still fairly new to LinuxCNC and QTVCP. I'm trying to modify the QTDragon GUI.
I added a status label and a progress bar using Qt5.
In handler.py, I added the following lines, and I can display the value:
- self.w.OilPumpPositionGage.setValue(int(multiplied_pwm_value))
- self.w.OilPumpPositionValue.setText(f"{multiplied_pwm_value:.2f} %")
My issue is that I would like multiplied_pwm_value = pwmgen.0.value * 100 but I can't figure out how to access the "pmw.0.value" value from handler.py
I tried working with the "newpin" function, but it's not working.
Where can I find information on how to do this, or could someone point me in the right direction?Thanks in advance
I'm still fairly new to LinuxCNC and QTVCP. I'm trying to modify the QTDragon GUI.
I added a status label and a progress bar using Qt5.
In handler.py, I added the following lines, and I can display the value:
- self.w.OilPumpPositionGage.setValue(int(multiplied_pwm_value))
- self.w.OilPumpPositionValue.setText(f"{multiplied_pwm_value:.2f} %")
My issue is that I would like multiplied_pwm_value = pwmgen.0.value * 100 but I can't figure out how to access the "pmw.0.value" value from handler.py
I tried working with the "newpin" function, but it's not working.
Where can I find information on how to do this, or could someone point me in the right direction?Thanks in advance
Last edit: 01 Jul 2025 20:10 by TMinj.
Please Log in or Create an account to join the conversation.
- cmorley
- Offline
- Moderator
-
Less
More
- Posts: 7940
- Thank you received: 2154
01 Jul 2025 21:55 #331081
by cmorley
Replied by cmorley on topic Import pin value in handler.py
if the pin value you wish to read is not created in the qtvcp handler then you must either connect to the pin or read it directly.
to read it directly:
pwmValue = self.h.hal.get_value('pwmgen.0.value')
use the full HAL name.
Otherwise you must make a qtdragon pin and connected it in a HAL file to the pwmgen pin.
Hopefully that helps.
to read it directly:
pwmValue = self.h.hal.get_value('pwmgen.0.value')
use the full HAL name.
Otherwise you must make a qtdragon pin and connected it in a HAL file to the pwmgen pin.
Hopefully that helps.
Please Log in or Create an account to join the conversation.
- TMinj
- Offline
- New Member
-
Less
More
- Posts: 2
- Thank you received: 0
02 Jul 2025 13:30 #331101
by TMinj
Replied by TMinj on topic Import pin value in handler.py
Thank you for your response. The line pwmValue = self.h.hal.get_value('pwmgen.0.value') is working well.
However, I’m having trouble with the QPushButton (or Action button). I’m not receiving any callback when it’s clicked.
However, I’m having trouble with the QPushButton (or Action button). I’m not receiving any callback when it’s clicked.
Please Log in or Create an account to join the conversation.
- cmorley
- Offline
- Moderator
-
Less
More
- Posts: 7940
- Thank you received: 2154
03 Jul 2025 05:44 #331143
by cmorley
Replied by cmorley on topic Import pin value in handler.py
Did you set any callback in designer or in the handler?
Please Log in or Create an account to join the conversation.
Moderators: cmorley
Time to create page: 0.061 seconds