Joystick Module For Arduino (SKU:DFR0061)

From DFRobot Electronic Product Wiki and Tutorial: Arduino and Robot Wiki-DFRobot.com

Introduction

Lots of robot projects need joystick. This module provides a affordable solution to that. Simply connect 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 connect to Arduino by IO Expansion Shield For Arduino(V5) (SKU: DFR0088) with supplied cables.

Specification

  • Interface Type:Analog
  • Three axis (X,Y,Z(button))
  • Size:37x25x32mm
  • Weight:15gram

Sample Code

// # 
// # Editor     : Lauren from DFRobot
// # Date       : 17.01.2012

// # Product name: Joystick Module
// # Product SKU : DFR0061
// # Version     : 1.0

// # Description:
// # Modify the Sample code for the Joystick Module 

// # Connection:
// #        X-Axis  -> Analog pin 0
// #        Y-Axis  -> Analog pin 1
// #        Z-Axis  -> Digital pin 3
// # 


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);
}




Nextredirectltr.pngGo Shopping Joystick Module For Arduino(SKU:DFR0061)