Pressed and Held actions in the same direction using SenseHat joystick?
Posted: Thu Apr 26, 2018 8:26 pm
I am currently working on a weather station sort of thing for scientific use and the device is supposed to be portable so actions will happen upon joystick events while it runs off boot. Now I don't want to display too much info when the joystick is in one direction in fact I would rather have one reading per direction. However, this is obviously also very limiting and so I was wondering if I could have right direction pressed do one thing and have right direction held do another. If it is possible wouldn't I also need to make it tell how long if held? Here is what I am thinking if it works:
The first concerning thing is immediately on press when you try to hold it wouldn't it activate the pressed rather than held. I would also like to add if this doesn't work is there any roundabout way to achieve this or no?
Code: Select all
if event.action == 'held' and event.direction == 'right':