KS0153 Keyestudio JoyStick Shield
KS0153 Keyestudio JoyStick Shield
KS0153 Keyestudio JoyStick Shield
Introduction:
Keyestudio Joystick Shield is particularly developed for you to design your own
game machines.
It adds an nRF24L01 RF interface and Nokia 5110 LCD interface, easy for
secondary game development. Because this RF module has stable performance,
and supports 6 in 1 game play, which allows developers to play freely. Nokia 5110
LCD is widely used in various development platforms, with highly cost-effective
and has a strong library support.
Here, we add enhanced Nokia5110 display library, including display bitmap, draw
point line circle flip and so on.
It also adds a Bluetooth module interface, for convenient Bluetooth wireless serial
communication, and a I2C communication interface for I2C devices connection.
1
www.keyestudio.com
keyestudio
Meanwhile, JoyStick Shield has a cross-shape PS2 joystick with button. There are
four round buttons, 2 small buttons, providing input expansion for Arduino joystick
and buttons. Onboard slide switch can switch between 3.3V and 5V.
Features:
PCB Dimensions:
2
www.keyestudio.com
keyestudio
Pinout Instructions:
3
www.keyestudio.com
keyestudio
Connect it Up:
Stack well the shield onto UNO R3 board, slide the switch to 5V.
4
www.keyestudio.com
keyestudio
Upload the Code:
Below is an example code, you can copy and paste it on Arduino IDE.
Download Arduino IDE
Install Arduino Driver
*****************************************************************
void setup()
{
for(int i=2; i<9; i++)
{
pinMode(i, INPUT);
digitalWrite(i, 1);
}
Serial.begin(9600);
}
void loop(){
int i, someInt, flag = 0;
for(i=2; i<9; i++)
{
someInt = digitalRead(i);
if(someInt == 0)
{
flag =1;
break;
}
}
if(flag == 1)
{
switch(i)
{
case 2: Serial.println("--------> Button A"); break;
case 3: Serial.println("--------> Button B"); break;
case 4: Serial.println("--------> Button C"); break;
5
www.keyestudio.com
keyestudio
case 5: Serial.println("--------> Button D"); break;
case 6: Serial.println("--------> Button E"); break;
case 7: Serial.println("--------> Button F"); break;
case 8: Serial.println("--------> Button KEY"); break;
default: break;
}
flag=0;
delay(200);
}
int sensorValue1 = analogRead(A0);
Serial.print("X = ");
Serial.println(sensorValue1 );
int sensorValue2 = analogRead(A1);
Serial.print("Y = ");
Serial.println(sensorValue2);
delay(200);
}
*****************************************************************
6
www.keyestudio.com
keyestudio
What You Should See?
Upload the above code to the board, open the serial monitor and set the baud rate
as 9600. You should see the X, Y data of joystick element. Press the button A,B,C
and D, the data will be displayed on the monitor.
7
www.keyestudio.com
keyestudio
8
www.keyestudio.com
keyestudio
For Applications:
Plug the joystick shield onto keyestudio UNO R3 board, you can connect a LCD and
temperature and humidity sensor to build the circuit experiment.
9
www.keyestudio.com