leonardo steering wheel project with pot issue

Hello everyone!

i start to development a DIY steering wheel project. its my first project because im so begginer to arduino :P

whatever i used this code. this code converted leonardo to joystick.

my problem is the windows controller cant read stable.

i cant used all stages in the test centry a pot using a small area. i try turned to right but i see the in test centry he is moved so fast right and left but i just turned right!

how i can fixed this problem ?

code:

include "Joystick.h"

// Create Joystick Joystick_ Joystick;

void setup() {

Joystick.begin(); Joystick.setXAxisRange(-127, 127); pinMode(A0, INPUT_PULLUP);

}

void loop() {

int pot1 = analogRead(A0); Joystick.setXAxis(pot1);

}

I don't really understand your description of the problem.

Try adding delay(100); into loop() so that it only updates about 10 times per second.

If that does not work then maybe you need some code to filter out small changes in the value from the potentiometer - something like

int potValue = 0;
static int prevValue = potValue;
potValue = analogRead(A0);
if (abs(potValue - prevValue) > 10) {
  Joystick.setXAxis(pot1);  
}
delay(100);

...R

Hi, Welcome to the forum.

Please read the first post in any forum entitled how to use this forum. http://forum.arduino.cc/index.php/topic,148850.0.html then look down to item #7 about how to post your code. It will be formatted in a scrolling window that makes it easier to read.

Can you please post a copy of your circuit, in CAD or a picture of a hand drawn circuit in jpg, png?

Can you please tell us your electronics, programming, Arduino, hardware experience?

Tom... :)

hello again.

first im sorry for everythink i can't speeking very well.

im try to make steering wheel and i used 5k pot (i have a 100k pot too but its just a test).

i want to if pot turned left, the steering wheel must to turned left (in game) and should to do like real.

#include "Joystick.h"

// Create Joystick
Joystick_ Joystick;


void setup() {

Joystick.begin();
Joystick.setXAxisRange(-127, 127);
pinMode(A0, INPUT_PULLUP);


}

void loop() {

int pot1 = analogRead(A0);
Joystick.setXAxis(pot1);  


}

its a my code to try. @Robin2 i can't try your advice yet i came home now.

|500x312

i used arduino in 2 week.

i know a basics but i can't used that.

"damnt what should i used now??" i know basics codes but how i use to? i realy dont know. its name a "experiment" huh?

Looks like you are setting the Min and Max to -127 and 127 and then passing a value from 0 to 1023. I think that only the values from 0 to 127 will work so the steering range goes from center to full right in the first 1/8th of a turn.

If you want a value from -127 to 127 from a pot, use "(analogRead(A0)/4)-127".