JOYSTICK MODULE

CODE:

#include <maker_joystick.h>

int main()
{

init();
maker_initializeJoystick(A0, A1, 2);
Serial.begin(9600);

while(1)
{

Serial.print(“Joystick values: “);

Serial.print(“X-INPUT: “);
Serial.println(maker_getJoystickInputX());

Serial.print(“Y-INPUT: “);
Serial.println(maker_getJoystickInputY());

Serial.print(“SWITCH-INPUT: “);
Serial.println(maker_getJoystickInputSwitch());

Serial.print(“\n\n”);

delay(200);

}

return 0;

}

Joystick consist of the two potentiometers allowing us to measure the movement of stick.  It can be used for controlling various number of things, but game controller is one of the most popular device.

VCC- power supply pin (5V)

GND – ground pin (0V)

X/Y – input analog pin for X/Y coordinates

Key- input digital pin for clicks

Coded by: