Joystick breakout module

From ElecFreaks
Jump to: navigation, search


This is a breakout module for Playstation2 analog joystick. 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.

Model: BKOUT_MD01

Joystick md1.jpg


  • Three axis (X,Y,Z(button))
  • Size:36x35x32mm


Hardware Installation

Joystick md03.jpg


Includes important code snippet. Demo code like :

**  Device: Joystick                                                **
**  File:   EF_Joystick_Test.c                                      **
**								    **
**  Created by ElecFreaks Robi.W /10 June 2011                      **
**                                                                  **
**  Description:                                                    **
**  This file is a sample code for your reference.                  **
**                                                                  **
**  Copyright (C) 2011 ElecFreaks Corp.                     	    **

int FirstShotX , FirstShotY;

void setup()
  for(int i=0; i<19; i++)
    pinMode(i, INPUT);
    digitalWrite(i, 1);
  FirstShotX = 0;
  FirstShotY = 0;

void loop(){
  int i, someInt, flag = 0;
  for(i=4; i<11; i++)
    someInt = digitalRead(i);
    if(someInt == 0)
      flag =1;
   if(flag == 1)
       case 4: Serial.println("--------> Button A"); break;
       case 5: Serial.println("--------> Button B"); break;
       case 6: Serial.println("--------> Button C"); break;
       case 7: Serial.println("--------> Button D"); break;
       case 8: Serial.println("--------> Button E"); break;
       case 9: Serial.println("--------> Button F"); break;
       case 10: Serial.println("--------> Button KEY"); break;
       default: break;
   int sensorValue = analogRead(A0);
   if(FirstShotX == 0)
     FirstShotX = sensorValue;
     Serial.print("FirstShotX = ");
   Serial.print("X = ");
   Serial.println(sensorValue - FirstShotX);
   sensorValue = analogRead(A1);
   if(FirstShotY == 0)
     FirstShotY = sensorValue;
     Serial.print("FirstShotY = ");
   Serial.print("Y = ");
   Serial.println(sensorValue - FirstShotY);


The projects and application examples.

Bill of Materials (BOM) /parts list

All the components used to produce the product.


Please list your question here:


If you have questions or other better design ideas,

Version Tracker

Revision Descriptions Release
v1.0b Initial public release date

Bug Tracker

Bug Tracker is the place you can publish any bugs you think you might have found during use. Please write down what you have to say, your answers will help us improve our


Additional Idea

The Additional Idea is the place to write your project ideas about this product, or other usages you've found. Or you can write them on Projects page.


How to buy

Click here to buy:

See Also

Other related products and resources.


This documentation is licensed under the Creative Commons Attribution-ShareAlike License 3.0 Source code and libraries are

licensed under GPL/LGPL, see source code files for details.

External Links

Links to external webpages which provide more application ideas, documents/datasheet or software libraries