How does it work?
Joystick 4 Click is based on the 2434804-1, an ALCOSWITCH series 5-position tactile switch from TE Connectivity. This tactile switch features an extended top actuator for precise and reliable input detection. Built with a stainless steel contact base and silver contact plating, it ensures durability and resistance to corrosion, providing an operational lifespan of 100,000 cycles. With its low-profile design, the switch can handle a contact current rating of 50mA and can operate at a voltage of 12VDC, in general. These tactile switches are critical for providing tactile feedback due to their high reliability and are used in various applications, including portable devices, instrumentation, security systems, gaming consoles, remote controllers, and handheld devices.
Joystick 4 Click leverages these attributes to deliver accurate and responsive input control, making it ideal for interactive projects where dependable tactile feedback is essential. Whether designing a game controller or developing a user interface for a portable device, this board offers the functionality and durability necessary for the most accessible integration.
This Click board™ is designed in a unique format supporting the newly introduced MIKROE feature called “Click Snap.” Unlike the standardized version of Click boards, this feature allows the main sensor area to become movable by breaking the PCB, opening up many new possibilities for implementation. Thanks to the Snap feature, the 2434804-1 can operate autonomously by accessing its signals directly on the pins marked 1-8. Additionally, the Snap part includes a specified and fixed screw hole position, enabling users to secure the Snap board in their desired location.
Joystick 4 Click interfaces with the host MCU through the TCA6408A port expander using the I2C interface. This port expander enables the control of the tactile switch and its associated control signals, including a dedicated signal for detecting joystick movements. When the tactile switch is activated, it provides an interrupt signal (INT) to the host MCU, ensuring immediate response to user inputs. Besides the I2C interface pins, the port expander also uses a reset (RST) pin and includes a jumper for selecting the I2C address labeled ADDR SEL.
This Click board™ can operate with either 3.3V or 5V logic voltage levels selected via the VCC SEL jumper. This way, both 3.3V and 5V capable MCUs can use the communication lines properly. Also, this Click board™ comes equipped with a library containing easy-to-use functions and an example code that can be used as a reference for further development.
Click Snap
Click Snap is an innovative feature of our standardized Click add-on boards, introducing a new level of flexibility and ease of use. This feature allows for easy detachment of the main sensor area by simply snapping the PCB along designated lines, enabling various implementation possibilities. For detailed information about Click Snap, please visit the official page dedicated to this feature.
Specifications
Type
Pushbutton/Switches
Applications
Ideal for game controllers, portable device interfaces, security systems, and instrumentation
On-board modules
2434804-1 – ALCOSWITCH series 5-position tactile switch from TE Connectivity
Key Features
Extended top actuator, durable construction, 100k operational lifespan, low-profile design, 50mA contact current rating, Click Snap feature, I2C interface with selectable address, and more
Interface
I2C
Feature
Click Snap,ClickID
Compatibility
mikroBUS™
Click board size
M (42.9 x 25.4 mm)
Input Voltage
3.3V or 5V
Pinout diagram
This table shows how the pinout on Joystick 4 Click corresponds to the pinout on the mikroBUS™ socket (the latter shown in the two middle columns).
Onboard settings and indicators
Label | Name | Default | Description |
---|---|---|---|
LD1 | PWR | – | Power LED Indicator |
JP1 | VCC SEL | Left | Power Voltage Level Selection 3V3/5V: Left position 3V3, Right position 5V |
JP2 | ADDR SEL | Left | I2C Address Selection 0/1: Left position 0, Right position 1 |
Joystick 4 Click electrical specifications
Description | Min | Typ | Max | Unit |
---|---|---|---|---|
Supply Voltage | 3.3 | – | 5 | V |
Software Support
We provide a library for the Joystick 4 Click as well as a demo application (example), developed using MIKROE compilers. The demo can run on all the main MIKROE development boards.
Package can be downloaded/installed directly from NECTO Studio Package Manager (recommended), downloaded from our LibStock™ or found on MIKROE github account.
Library Description
This library contains API for Joystick 4 Click driver.
Key functions
-
joystick4_get_int_pin
This function returns the INT pin logic state. -
joystick4_get_pins
This function reads all input pins logic state. -
joystick4_get_position
This function returns the joystick position flag extracted from the input pins state mask.
Example Description
This example demonstrates the use of the Joystick 4 Click board™ by reading and displaying the joystick position.
void application_task ( void )
{
uint8_t pin_mask = 0;
if ( JOYSTICK4_PIN_STATE_LOW == joystick4_get_int_pin ( &joystick4 ) )
{
if ( JOYSTICK4_OK == joystick4_get_pins ( &joystick4, &pin_mask ) )
{
log_printf ( &logger, " Joystick position: " );
switch ( joystick4_get_position ( pin_mask ) )
{
case JOYSTICK4_POSITION_IDLE:
{
log_printf ( &logger, "IDLE" );
break;
}
case JOYSTICK4_POSITION_CENTER:
{
log_printf ( &logger, "CENTER" );
break;
}
case JOYSTICK4_POSITION_CENTER_UP:
{
log_printf ( &logger, "CENTER-UP" );
break;
}
case JOYSTICK4_POSITION_CENTER_RIGHT:
{
log_printf ( &logger, "CENTER-RIGHT" );
break;
}
case JOYSTICK4_POSITION_CENTER_DOWN:
{
log_printf ( &logger, "CENTER-DOWN" );
break;
}
case JOYSTICK4_POSITION_CENTER_LEFT:
{
log_printf ( &logger, "CENTER-LEFT" );
break;
}
case JOYSTICK4_POSITION_UP:
{
log_printf ( &logger, "UP" );
break;
}
case JOYSTICK4_POSITION_UPPER_RIGHT:
{
log_printf ( &logger, "UPPER-RIGHT" );
break;
}
case JOYSTICK4_POSITION_RIGHT:
{
log_printf ( &logger, "RIGHT" );
break;
}
case JOYSTICK4_POSITION_LOWER_RIGHT:
{
log_printf ( &logger, "LOWER-RIGHT" );
break;
}
case JOYSTICK4_POSITION_DOWN:
{
log_printf ( &logger, "DOWN" );
break;
}
case JOYSTICK4_POSITION_LOWER_LEFT:
{
log_printf ( &logger, "LOWER-LEFT" );
break;
}
case JOYSTICK4_POSITION_LEFT:
{
log_printf ( &logger, "LEFT" );
break;
}
case JOYSTICK4_POSITION_UPPER_LEFT:
{
log_printf ( &logger, "UPPER-LEFT" );
break;
}
default:
{
log_printf ( &logger, "UNKNOWN" );
break;
}
}
log_printf ( &logger, "rnn" );
}
}
}
The full application code, and ready to use projects can be installed directly from NECTO Studio Package Manager (recommended), downloaded from our LibStock™ or found on MIKROE github account.
Other MIKROE Libraries used in the example:
- MikroSDK.Board
- MikroSDK.Log
- Click.Joystick4
Additional notes and informations
Depending on the development board you are using, you may need USB UART click, USB UART 2 Click or RS232 Click to connect to your PC, for development systems with no UART to USB interface available on the board. UART terminal is available in all MIKROE compilers.
mikroSDK
This Click board™ is supported with mikroSDK – MIKROE Software Development Kit. To ensure proper operation of mikroSDK compliant Click board™ demo applications, mikroSDK should be downloaded from the LibStock and installed for the compiler you are using.
For more information about mikroSDK, visit the official page.