#Gear up/down with potentiometer

1 messages · Page 1 of 1 (latest)

thorny warren
#

Hey guys,
me again. as the title says, I want to lift and lower my gear with a potentiometer. there is no example in hubhop, so, maybe someone can tell me how I could achieve this goal. Maybe I can use this and change it somehow into gear?
@ 355 - 234.0429 * 0 max 16383 min (>K:SPOILERS_SET)

young torrent
#

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.

thorny warren
young torrent
#

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%

young torrent
#

@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

thorny warren
#

Sry, i have to go on tomorrow. Thx a lot

thorny warren
#

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

young torrent
#

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.

glacial sapphire
#

in the board device list

thorny warren
#

yes, I did that. Today in the morning, I replaced the potentiometer with an magnetic switch. this should do the job. 🙂

glacial sapphire
#

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.

thorny warren
fathom nightBOT
#

Since this is resolved I'm locking the thread. For additional questions or similar issues please start a new thread in #1028767888242376794. Happy flying!

young torrent
#

@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)