I'm using a CLUE to build a small wearable device. I'd like to be able to use the Arcada library to handle the display and to deal with inputs, specifically with allowing the wearer to select items from a menu. But since there are only two buttons (which would already be mapped to select and cancel) I need another way to handle menu navigation.
What I'd like to do is use the gesture sensor for this. I've verified already that I can read gestures from the APSD9960 (though it's rotated 90 degrees from the display orientation :) ) but I don't see a way to pass those gestures along as if they were joystick input.
Is there a way to use the APSD to simulate a joystick in Arcada? Or failing that, is there a way to programmatically simulate a joystick event in a way that Arcada will catch? (I can grab the gesture input if there's a method I can call like "arcada.joystick_left()".)
Of course if there are better ideas for handling menu navigation on the CLUE without me having to roll my own I'd love to know them!
Simulate joystick with gesture sensor in Arcada
Moderators: adafruit_support_bill, adafruit
Please be positive and constructive with your questions and comments.
- mccollam
- Posts: 6
- Joined: Fri Mar 10, 2017 3:00 pm
- blnkjns
- Posts: 963
- Joined: Fri Oct 02, 2020 3:33 am
Re: Simulate joystick with gesture sensor in Arcada
I always skip Arcada as it makes compilation times rather hefty. Most of the times you only need a couple of its features, mostly display and input, and those are easily installed by itself. Hardest part is to find the pin numbers. Input is no issue on the CLUE, as it is just basic switches connected to GND. Other boards like the PyBadge have a shift register for the inputs, not here.
So maybe you are fully served by just using the display library, GFX, and the gesture library.
So maybe you are fully served by just using the display library, GFX, and the gesture library.
- adafruit_support_mike
- Posts: 67485
- Joined: Thu Feb 11, 2010 2:51 pm
Re: Simulate joystick with gesture sensor in Arcada
It's possible, but not trivial.
The Arcada menu code calls a function named .readButtons() defined here:
https://github.com/adafruit/Adafruit_Ar ... #L427-L558
You'd have to modify that to call your code that interprets gestures.
The Arcada menu code calls a function named .readButtons() defined here:
https://github.com/adafruit/Adafruit_Ar ... #L427-L558
You'd have to modify that to call your code that interprets gestures.
- mccollam
- Posts: 6
- Joined: Fri Mar 10, 2017 3:00 pm
Re: Simulate joystick with gesture sensor in Arcada
Thanks Mike.
To be honest, if I need to patch Arcada itself it's probably less effort overall to just roll my own anyway. Thanks for the info and the pointer!
To be honest, if I need to patch Arcada itself it's probably less effort overall to just roll my own anyway. Thanks for the info and the pointer!
- adafruit_support_mike
- Posts: 67485
- Joined: Thu Feb 11, 2010 2:51 pm
Re: Simulate joystick with gesture sensor in Arcada
The Arcada menu code uses the GFX libraries button class. You can probably steal the relevant code for your own version.
Please be positive and constructive with your questions and comments.