Replies: 4 comments 3 replies
-
Hi @ndgipper, You've got me stumped as far as Definitely not a dumb question, so no need to apologize! |
Beta Was this translation helpful? Give feedback.
-
As far as your use case is concerned, you should be able to accomplish that without having to call the individual import board
from analogio import AnalogIn
from joystick_xl.inputs import Axis, Button
from joystick_xl.joystick import Joystick
joystick = Joystick()
joystick.add_input(
Button(board.GP0), # this button is tied to pin GP0 on my CircuitPython board (a Raspberry Pi Pico in this case)
Axis(), # axis[0] is the x-axis - notice that I haven't tied it directly to a pin on the board
)
raw_axis_0 = AnalogIn(board.A0)
raw_axis_1 = AnalogIn(board.A1)
joystick.update()
while True:
if joystick.button[0].is_pressed:
joystick.axis[Axis.X].source_value = raw_axis_0.value
else:
joystick.axis[Axis.X].source_value = raw_axis_1.value
joystick.update() If you have code you're willing to share - or just more information about your use case - I should be able to help you sort through it. |
Beta Was this translation helpful? Give feedback.
-
Here's the work in progress. I only have 2 axes active right now.
|
Beta Was this translation helpful? Give feedback.
-
My code is more "readable" to me the way I've made all of the Axis inputs virtual. However, I think it's only necessary that the Axis 1 (pot1) input be virtual. Perhaps a slicker example would should the mixture of virtual and non-virtual axes. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I'm trying to follow the reset_all path. It looks like it calls update() which reads the devices current values and thus an IDLE report never gets sent. Am I reading this wrong? I expected reset_all to send a truly idle report.
The reason I'm on this path is I'm trying to find a way to call update_axis,buttons,hats() and then replace an axis value to be the same as a different axis value before the report is sent. I want to do this when a certain button is True. Otherwise, each axis would get its correct value reported.
However, I've gotten distracted trying to see how reset_all works. I'm probably missing something. Apologies for asking a dumb question.
Beta Was this translation helpful? Give feedback.
All reactions