Free Shipping Over $119



Arduino UNO R3/MEGA 2560 R3 Project 27: Joystick Module

Posted by Fiona Su on

Introduction

Lots of robot projects need joystick. This module provides an affordable solution. By simply connecting to two analog inputs, the robot is at your commands with X, Y control. It also has a switch that is connected to a digital pin. This joystick module can be easily connected to Arduino by IO Shield. This module is for Arduino(V5) with cable supplied.

thumb

Video Review

Specification

  • Supply Voltage: 3.3V to 5V
  • Interface: Analog x2, Digital x1

Connection

Connection for REV4:

0078-46png.png

Connection for 2560 R3:

Ks0399 connect35-1.png

Sample Code:

int JoyStick_X = 0; //x
int JoyStick_Y = 1; //y
int JoyStick_Z = 3; //key
  void setup() 
{
  pinMode(JoyStick_Z, INPUT); 
  Serial.begin(9600); // 9600 bps
}
void loop() 
{
  int x,y,z;
  x=analogRead(JoyStick_X);
  y=analogRead(JoyStick_Y);
  z=digitalRead(JoyStick_Z);
  Serial.print(x ,DEC);
  Serial.print(",");
  Serial.print(y ,DEC);
  Serial.print(",");
  Serial.println(z ,DEC);
  delay(100);
}

Result

Wiring well and uploading the code, open the serial monitor and set the baud rate to 9600, push the joystick, you will see the value shown below.

Ks0399 Result35-1.png 

All Tutorial

Buy 

0 comments

Leave a comment

Please note, comments must be approved before they are published