Ahead of everything, i apologise as i am so new to all this. I have spent the last week learning something i really dont have much of an idea about. After a week, i know enough to be able to communicate with hopefully, some of you in a way that i dont frustrate you.
Perhaps i have the wrong board, the wrong software, i dont know.
Here is my project
4 simple rotary encoders mounted in a housing, connected it to USB port, using it in my flight sim so that i can adjust values for different instruments in the cockpit eg heading bug, course bar altitude, VOR (these can be assigned in the sim once device is plugged in and recognised as a USB device
Equipment and software
U PICO Pi board
flightsim - Xplane 11/12
Success thus far
I have managed to find a simple code for one rotary encoder, i have worked out some of the coding, trial and error and have limited understanding of coding - but in the readout, as i turn the encoder i have the values increasing and decreasing.
I have no idea how to use the current code i found and duplicate it 3 more times for the other 3 encoders.
I have no idea of what i need to do in order for the pico board to be recognised as a USB device - whether it needs to be a gamepad or joystick or something else
I “think” i will need to install a library for this to happen, but again, no idea which one or where to get it from, let alone the code i need for the pico so that it just works.
Below is a link i used from youtube (this is how i found this forum) the link to the files im using and a copy of the code which works, showing the increasing and decreasing values of the encoder as i turn the knob.
I am pretty sure you are all laughing right now, because what i am trying to achieve is probably so simple as putting the keys in the ignition of a car and turning the key, for that i apologise.
I am determined to get this done, i have even tried to use Arduino IDE to do this, but there too i run into iussues where i cannot find any good tutorials, or code to help me…even chatgpt didnt work - that was the last resort.
So i hope someone here has the patience to help or to guide me so that i can learn how to do this so i feel some sense of achievement - even if it you attach what ever i need to this post just to get me out of your hair.
Thank you ahead and please be kind …lol
link i used to find you with the files in the description
code i am using at the moment (its for only 1 encoder)
# A simple example showing how to read values from a rotary encoder # Requires the RotaryIRQ library from https://github.com/miketeachman/micropython-rotary from rotary_irq_rp2 import RotaryIRQ # Enter the two GPIO pins you connected to data pins A and B # Note the order of the pins isn't strict, swapping the pins # will swap the direction of change. rotary = RotaryIRQ(3, 4, pull_up=True) # If you're using a Standalone Rotary Encoder instead of a module, # you might need to enable the internal pull-ups on the Pico # rotary = RotaryIRQ(14, 15, pull_up=True) current_val = 0 # Track the last known value of the encoder while True: new_val = rotary.value() # What is the encoder value right now? if current_val != new_val: # The encoder value has changed! print('Encoder value:', new_val) # Do something with the new value current_val = new_val # Track this change as the last know value rotary2 = RotaryIRQ(6, 7, pull_up=True) current_val = 0 # Track the last known value of the encoder'