Homepage
The self made joy stick as input device and its wiring
10 Sep 2017 20:50
Hardware of Bechele 2



Verwandte Themen:
Related topics:


Project main wiring
The joy stick

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:

 54-teach device.sch.pdf

  

Here the software of the joy stick for downloading:

/images/attach/SteuerknueppelAveragedOffset.ino

or usung  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;
}
}


*