Arduino Joystick for sensor shield

$7.31
  • Units in Stock: 221
  • Date Added: Sunday 07 February, 2010
Add to Cart:

Product Description:

On the principle, the control rod can be considered as organized by the two potentiometer and a button :

Two of the input values of potentiometer respectively show the user offset in the X and Y axis, and the type of offset is analog. The button is used to show whether the user push down button in the Z axis, its type is digital. Therefore the control rod contain a total of three input interface which are used to connect X, Y, and Z:


You can use it together with Arduino Sensor Sheild. Connect it to Arduino via corresponding pin link. In the example below, the X and Y axes is connected to and analog input A1 and A0 , and Z axis is connected to the digital I/O 7 foot:

The corresponding code shown below:


int sensorPin = 5;
int value = 0;

void setup() {
  pinMode(7, OUTPUT);
  Serial.begin(9600);
}

void loop() {
  value = analogRead(0);
  Serial.print("X:");
  Serial.print(value, DEC);

  value = analogRead(1);
  Serial.print(" | Y:");
  Serial.print(value, DEC);

  value = digitalRead(7);
  Serial.print(" | Z: ");
  Serial.println(value, DEC);

  delay(100);
}

Qty Discounts Off Price
1-4
$7.31
5-9
$6.21
10-49
$5.85
50+
$5.04
Copyright © 2017 Elechouse.
Powered by ELECHOUSE