Thanks again for your support, though the answers leave a lot of new questions.
Can't you make an example or something, as i started out im new to this,
and i think its much easyer to learn from examples.
I found this code on the net and changed it a bit for my setup and i got fine
serial readings in Arduino both X-Y values from the thumbstick.
But i can't figure out how to mix this code with the Adafruit motorshield
to make it work - can you take a look.
I use this code:
#include <Stepper.h>
#include <AccelStepper.h>
#include <AFMotor.h>
AF_Stepper motor1(20, 1);
AF_Stepper motor2(20, 2);
const int selectPin = 2;
const int joystick_xPin = A0;
const int joystick_yPin = A5;
int oldX = 0;
int oldY = 0;
int oldSelect = 0;
void setup()
{
pinMode(selectPin, INPUT);
digitalWrite(selectPin, HIGH);
Serial.begin(9600);
}
void loop()
{
int joystick_x;
int joystick_y;
int select;
joystick_x = map(analogRead(joystick_xPin), 0, 1023, 1, 20);
joystick_y = map(analogRead(joystick_yPin), 0, 1023, 1, 20);
select = !digitalRead(selectPin);
if((oldX != joystick_x) ||
(oldY != joystick_y) ||
(oldSelect != select)){
Serial.print("joystick X: ");
Serial.print(joystick_x);
Serial.print(" joystick Y: ");
Serial.print(joystick_y);
if(select){
Serial.print(" select");
}
Serial.println("");
oldX = joystick_x;
oldY = joystick_y;
oldSelect = select;
}
delay(10);
}
Thanks