Cleric-K / vJoySerialFeeder

Feed Virtual Joystick driver with data from a serial port
GNU General Public License v3.0
258 stars 55 forks source link

Potentiometers on Arduino Mega #39

Closed jpasichnyk closed 2 years ago

jpasichnyk commented 4 years ago

I'm trying to get some slide potentiometers which are connected to an Arduino mega via A0, A1, and A2 pins. Should I list these in the sketch as 0-2 or should they be 54-56?

jpasichnyk commented 4 years ago

Ok, I figured out what the issue is. I was always getting an analogRead value of 1023 from the analog pins, regardless of using the numeric or A0-A15 pin numbers. It turns out that the proper way to read these pins on a Arduino Mega is A0-A15, however setting the analogReference(ANALOG_REFERENCE) causes all these values to be returned as 1023. Removing the call to set analogReference allows the pin values to be read successfully.

jpasichnyk commented 4 years ago

https://github.com/Cleric-K/vJoySerialFeeder/pull/40