#Gear up/down with potentiometer
1 messages · Page 1 of 1 (latest)
you can just configure the potentiometer as a switch and it will make OnPress and OnRelease events like a button. It switches over at midpoint.
that sounds good. how can i achieve this goal?
both a switch and a potentiometer work by connecting a data pin on the arduino to GND (ground). The regular switch just does it instantly, while a potentiometer does it gradually, but the end result is the same: at the extremes of the gradual connection it is either not connected, or connected.
how is this pot connected to your arduino?
remove the potentiometer config and add it as a button instead, it should just work?
I made this audio panel for the CJ4 earlier, it has an arduino Mega and I think 14 potentiometers, but not all of them had a potentiometer function in MSFS2020, so I just added them as switch. They make a OnPress event when I turn them over 50%
@thorny warren are you able to get it to work? I know when you are new, everything can be confusing, so feel free to ask, if something is not clear
Sry, i have to go on tomorrow. Thx a lot
ok, I have tested it now. It does not work. the value change is too low. I have to replace this part with a switch. Maybe a magnetic one, so I do not have to change my design. 🙂
you can mark this as solved
ok. just to confirm, did you wire the potentiometer so that one side is on +5V and the other is at GND? That makes a difference in the value range.
yes
Just a reality check... did you configure the potentiometer device as a button, not analog input?
in the board device list
yes, I did that. Today in the morning, I replaced the potentiometer with an magnetic switch. this should do the job. 🙂
No, that was not my question, but I guess you have solved your problem by changing the physical device (unnecessarily).
What was suggested, but you apparently did not understand, was to leave the potentiometer connected to the arduino, but instead of configuring it as an analog input device, simply tell Mobiflight it is a button connected to the same analog pin.
Mobiflight would have detected the button press and release as you moved the potentiometer right and left through the middle of the scale.
I did it like you said. But it did not recognize a button press. so i think that the potentiometer in my construction is not turned far enough for this. But it is solved. thanks again.
Since this is resolved I'm locking the thread. For additional questions or similar issues please start a new thread in #1028767888242376794. Happy flying!
@thorny warren this thread is already locked, so you cannot reply, but yes, that is likely the case - the potentiometer would need to go from 0 to 512 in order to trigger as a switch, that is the halfway point between 0 and 1023. Button works similarly but instead of detecting a range of voltage, it just detects it as "connected" or "not connected", which in practice seems to happen at 2.5V (the range of analog reading of a potentiometer on 5V arduinos is 0->5V)