Menu Close

The Joy Stick

The self made joy stick as an input device and its wiring

The joy Stich to record the servo movement syncronous to the sound is realized using an arduino.

The wiring diagram can be downloaded using the link below:

The self made joystick
Bottom side

Here the software of the joy stick for downloading:

The Arduino source code for the joy stick

or using  drag and drop:

 // These constants won't change.  They're used to give names
// to the pins used:
const int analogInPin = A0; // Analog input pin that the potentiometer is attached to
const int analogInPin2 = A1 ; // Analog output pin that the LED is attached to
const int Button1 = 2 ;
const int Button2 = 8 ;
int AsensorValue1 = 512; // value read from the pot
int AsensorValue2 = 512; // value read from the pot
int inByte = 0; // incoming serial byte

void setup() {
// initialize serial communications at 9600 bps:
Serial.begin(38400);
}

void loop() {
// read the analog in value:
AsensorValue1 = (AsensorValue1/10*9+analogRead(analogInPin)/10); // Mittelwertberechnung
AsensorValue2 = (AsensorValue2/10*9+analogRead(analogInPin2)/10); // schleichend
int button1State = digitalRead(Button1);
int button2State = digitalRead(Button2);
if (Serial.available() > 0) {
inByte = Serial.read();
if (inByte == 52) {
// print the results to the serial monitor:
Serial.print(AsensorValue1-50);
Serial.print(" ");
Serial.print(AsensorValue2-110);
Serial.print(" ");
Serial.print(button1State);
Serial.print(" ");
Serial.println(button2State);
}
inByte = 0;
}
}

Leave a Reply

Your email address will not be published. Required fields are marked *