Ks0245 keyestudio EASY plug Joystick Module: Difference between revisions

From Keyestudio Wiki
Jump to navigation Jump to search
No edit summary
Line 20: Line 20:
Connect the EASY Plug Joystick module to control board using an RJ11 cable. Then connect the control board to your PC with a USB cable.
Connect the EASY Plug Joystick module to control board using an RJ11 cable. Then connect the control board to your PC with a USB cable.
<br>[[File:KS0245.jpg|500px|frameless|thumb]]<br>
<br>[[File:KS0245.jpg|500px|frameless|thumb]]<br>
<span style="color: red">'''Note:''' X-axis is connected to A6, Y-axis is connected to A7, Z-axis is default by D2  <br>


<br>
<br>
==Upload the Code==
==Upload the Code==
Copy and paste below code to [http://wiki.keyestudio.com/index.php/How_to_Download_Arduino_IDE Arduino IDE] and upload. 
<br>[[File:ks0398 14.1.png|500px|frameless|thumb]]<br>
<pre>
int JoyStick_X = 6; //x
int JoyStick_Y = 7; //y
int JoyStick_Z = 2; //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);
}
</pre>


<br>
<br>
==What You Should See==
==What You Should See==
<br>[[File:ks0398 14-1.png|500px|frameless|thumb]]<br>
<br>
Done uploading the code, open the serial monitor and set the baud rate to 9600. If push the Joystick button towards different direction, you should get the different value.   
Done uploading the code, open the serial monitor and set the baud rate to 9600. If push the Joystick button towards different direction, you should get the different value.   
<br>[[File:KS0245-3.png|700px|frameless|thumb]]<br>
<br>[[File:ks0398 14-2.png|500px|frameless|thumb]]<br>


<br>
<br>
==Controlling LED Light==
<br>
'''Hookup Guide'''<br>
<br>[[File:遥感灯.jpg|500px|frameless|thumb]]<br>
<br>
'''Test Code'''<br>
<br>[[File:ks0398 14.2.png|500px|frameless|thumb]]<br>
<br>
'''What You Should See'''<br>
Upload the code successfully, push the Joystick X-axis to downward, the LED light connected to D5 will become off. <br>
If push the Joystick Y-axis to leftward, the LED light connected to D6 will be turned off.
Z-axis will control the LED light connected to D7.
<br>[[File:ks0398 14-3.png|500px|frameless|thumb]]<br>
<br>[[File:ks0398 14-4.png|500px|frameless|thumb]]<br>


<br>
==Resources ==
==Resources ==
'''Download the PDF:'''<br>
'''Download the PDF:'''<br>

Revision as of 14:48, 8 May 2019

EASY plug Joystick Module

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 connect to EASY PLUG control board with only one cable.


Specifications

  • Supply Voltage: 3.3V to 5V
  • Interface: Digital


Technical Details

  • Dimensions: 45mm*28mm*33mm
  • Weight: 12.5g


Connect It Up

Connect the EASY Plug Joystick module to control board using an RJ11 cable. Then connect the control board to your PC with a USB cable.
thumb
Note: X-axis is connected to A6, Y-axis is connected to A7, Z-axis is default by D2


Upload the Code


thumb


What You Should See


thumb

Done uploading the code, open the serial monitor and set the baud rate to 9600. If push the Joystick button towards different direction, you should get the different value.
thumb


Controlling LED Light


Hookup Guide

thumb

Test Code

thumb

What You Should See
Upload the code successfully, push the Joystick X-axis to downward, the LED light connected to D5 will become off.
If push the Joystick Y-axis to leftward, the LED light connected to D6 will be turned off. Z-axis will control the LED light connected to D7.
thumb

thumb



Resources

Download the PDF:
https://drive.google.com/open?id=1eN8fs6Ew9sOMBcJxqhNgWk3qrMnSba9S

Download the Code:
https://drive.google.com/open?id=1QTwt5lOX7qMmIkL-I0b9ANV1N-6RLYl6



Buy from