Joystick Module

(5 customer reviews)

$10.50

5 in stock

Description

Analog joysticks are a great way to add some control in your projects. The module has 5 pins: Vcc, Ground, X, Y, Key. The thumbstick is analog and should provide more accurate readings than simple ‘directional’ joysticks tat use some forms of buttons, or mechanical switches. Additionally, you can press the joystick down to activate a ‘press to select’ push-button.

Joystick Module Code


/* SETUP

Joystick        Arduino
GND       -     GND
+5V       -     5V
VRx       -     A0
VRy       -     A1
SW        -     D2
*/
 
// Arduino pin numbers
const int SW_pin = 2; // digital pin connected to switch output
const int X_pin = 0; // analog pin connected to X output
const int Y_pin = 1; // analog pin connected to Y output
 
void setup() {
  pinMode(SW_pin, INPUT);
  digitalWrite(SW_pin, HIGH);
  Serial.begin(115200);
}
 
void loop() {
  Serial.print("Switch:  ");
  Serial.print(digitalRead(SW_pin));
  Serial.print("\n");
  Serial.print("X-axis: ");
  Serial.print(analogRead(X_pin));
  Serial.print("\n");
  Serial.print("Y-axis: ");
  Serial.println(analogRead(Y_pin));
  Serial.print("\n\n");
  delay(200);
}

 

Additional information

Weight 0.012 kg
  1. Vmvmvs

    order dostinex 0.25mg – buy generic cabgolin online order alesse sale

  2. Grobend

    Similarly, neurons in the lateral nucleus i priligy amazon uk

  3. Wlfmpy

    正規品プレドニン錠の正しい処方 – г‚ўгѓўг‚­г‚·гѓ« жµ·е¤–йЂљиІ© アジスロマイシン жµ·е¤–йЂљиІ©

  4. Fdypch

    正規品シルデナフィル錠の正しい処方 – г‚їгѓЂгѓ©гѓ•г‚Јгѓ«гЃ®йЈІгЃїж–№гЃЁеЉ№жћњ г‚їгѓЂгѓ©гѓ•г‚Јгѓ« е‰ЇдЅњз”Ё

  5. Ytdape

    гѓ—гѓ¬гѓ‰гѓ‹гѓійЊ  5 mg еј·гЃ• – アキュテイン通販 正規品アキュテイン錠の正しい処方

Add a review

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