XHC-WHB04-4 Python component

More
5 years 9 months ago - 5 years 9 months ago #196569 by fixer
Replied by fixer on topic XHC-WHB04-4 Python component
yes.

read realpython.com/python-boolean/

whb allows 2 simultaneous keys pressed, it returns the first pressed in [2] and the second in [3] this allows to have alternate key functionality with fn key...
Last edit: 5 years 9 months ago by fixer.

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

More
5 years 9 months ago #196573 by probotix
Ok, understand now. So, why do you have to check both data[2] and data[3]?

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

More
5 years 9 months ago #196575 by fixer
Replied by fixer on topic XHC-WHB04-4 Python component
do a print(data) in line 180 and watch output in terminal while pressing different buttons on the pendant...

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

More
5 years 9 months ago #196577 by probotix
I couldn't come up with any combination of button presses that changed data[3], it appears to always be zero.

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

More
5 years 9 months ago #196579 by probotix
Also, have you come up with a way to identify button releases? I see the release events happen, but it doesn't appear to identify which button was released.

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

More
5 years 9 months ago #196602 by fixer
Replied by fixer on topic XHC-WHB04-4 Python component
Release event is identified as data[2]==0

If you want to know which button was released you should first save the state of pressed buttons and compare it with the state in the next iteration of while(1)

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

Time to create page: 0.141 seconds
Powered by Kunena Forum