Hi all, I've been working on a DIY handbrake for sim racing. I picked up a cheap arduino pro micro board and a linear sliding 10k potentiometer which suited my needs.
I installed the SparkFun board in the Arduino IDE and when I did the blinking test everyting seemed to work.
See my wiring diagram for the wiring info.
everytime I use analogRead(pin), no matter which pin I use I get the max value of 1023, even when moving the potentiometer slider.
I tested the analog input so I was sure they did work, when I connected a cable directly from GND to A2 I got the value 0, and this was the same for all other pins.
Then I measured the voltages, which were all at around 4.60.
Then to make sure the potentiometer wasn't malfunctioning I measured the Ohm too, and the values changed as expected when sliding the potentiometer.
I tried different usb wires, and different wiring, but no luck.
If I disconnect the power from the potentiometer, so only GND arduino, GND pot and input pin are connected the values go crazy, as soon as I reconnect the power it's stuck at 1023 again.
I'm out of ideas now, does anyone have an idea on what's causing this?
#include <Joystick.h>
void setup()
{pinMode(A2, INPUT);
Joystick.begin();}
const int pinToButtonMap = A2;
void loop()
{
Serial.println(analogRead(A2));
int pot = analogRead(A2);
int mapped = map(pot,0,1023,0,255);
{Joystick.setThrottle(mapped);}
}
(I'll include the code, not that it matters here I think but just in case anyone asks)