I'm making ebrake for sim racing and i have installed 10k dual unit potentiometer, but it work only in a half range, I think it might be something wrong with the code
// Analog eBrake-Handbrake
// PIN A0 to 10k pot output - Throttle Axis
// Use with Arduino ProMicro.
// Tested and working in DiRT RALLY + ASSETTO CORSA
// by AMSTUDIO
// 20.1.2017
#include <Joystick.h>
void setup()
{pinMode(A0, INPUT);
Joystick.begin();}
const int pinToButtonMap = A0;
void loop()
{int pot = analogRead(A0);
int mapped = map(pot,0,1023, 0, 255);
{Joystick.setThrottle(mapped);}}```
Why a dual pot? Does it have concentric shafts? How do you have it wired? Schematic, please, showing all the pot connections.
What values are you getting from the analog read? What clue was there that the code was a problem?
Paul