Experience the future of navigation with the smart joystick concept, providing users with a seamless and intuitive way to explore digital worlds
A
A
Hardware Overview
How does it work?
Joystick 2 Click is based on the SKRHABE01, a 4-direction joystick switch with Center-push Function from Alps Alpine. It is positioned on the board so it is easily accessible for interacting and the lever could be pressed, activating the microswitch that way. The microswitch is actuated by applying very little physical force, using a tipping-point mechanism which results in fast and reliable snap-in action. It has both NO (Normal open) contacts routed to the mikroBUS™ over the port expander. The switch lines are equipped with the RC filters, which serve as debouncing
elements for the switch and also to pull-up the lines when they are left afloat. This way, the contact bouncing is reduced even further, resulting in an accurate detection of the switching event. As already mentioned above, this click board™ contains the port expander, relatively large number of needed GPIO pins for the joystick switch. Used IC is PCA9538A, Low-voltage 8-bit I2C-bus I/O port with interrupt and reset, from NXP Semiconductors. It uses the I2C communication for interfacing with the main MCU, which simplifies the number of needed pins,
and therefore the design itself. The Active LOW reset input (RESET) and Open-drain active LOW interrupt output (INT) pins helps simplifying the design even further. 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.
Features overview
Development board
Arduino UNO is a versatile microcontroller board built around the ATmega328P chip. It offers extensive connectivity options for various projects, featuring 14 digital input/output pins, six of which are PWM-capable, along with six analog inputs. Its core components include a 16MHz ceramic resonator, a USB connection, a power jack, an
ICSP header, and a reset button, providing everything necessary to power and program the board. The Uno is ready to go, whether connected to a computer via USB or powered by an AC-to-DC adapter or battery. As the first USB Arduino board, it serves as the benchmark for the Arduino platform, with "Uno" symbolizing its status as the
first in a series. This name choice, meaning "one" in Italian, commemorates the launch of Arduino Software (IDE) 1.0. Initially introduced alongside version 1.0 of the Arduino Software (IDE), the Uno has since become the foundational model for subsequent Arduino releases, embodying the platform's evolution.
Microcontroller Overview
MCU Card / MCU
Architecture
AVR
MCU Memory (KB)
32
Silicon Vendor
Microchip
Pin count
28
RAM (Bytes)
2048
You complete me!
Accessories
Click Shield for Arduino UNO has two proprietary mikroBUS™ sockets, allowing all the Click board™ devices to be interfaced with the Arduino UNO board without effort. The Arduino Uno, a microcontroller board based on the ATmega328P, provides an affordable and flexible way for users to try out new concepts and build prototypes with the ATmega328P microcontroller from various combinations of performance, power consumption, and features. The Arduino Uno has 14 digital input/output pins (of which six can be used as PWM outputs), six analog inputs, a 16 MHz ceramic resonator (CSTCE16M0V53-R0), a USB connection, a power jack, an ICSP header, and reset button. Most of the ATmega328P microcontroller pins are brought to the IO pins on the left and right edge of the board, which are then connected to two existing mikroBUS™ sockets. This Click Shield also has several switches that perform functions such as selecting the logic levels of analog signals on mikroBUS™ sockets and selecting logic voltage levels of the mikroBUS™ sockets themselves. Besides, the user is offered the possibility of using any Click board™ with the help of existing bidirectional level-shifting voltage translators, regardless of whether the Click board™ operates at a 3.3V or 5V logic voltage level. Once you connect the Arduino UNO board with our Click Shield for Arduino UNO, you can access hundreds of Click boards™, working with 3.3V or 5V logic voltage levels.
Used MCU Pins
mikroBUS™ mapper
Take a closer look
Click board™ Schematic
Step by step
Project assembly
Track your results in real time
Application Output
This Click board can be interfaced and monitored in two ways:
Application Output
- Use the "Application Output" window in Debug mode for real-time data monitoring. Set it up properly by following this tutorial.
UART Terminal
- Monitor data via the UART Terminal using a USB to UART converter. For detailed instructions, check out this tutorial.
Software Support
Library Description
This library contains API for Joystick 2 Click driver.
Key functions:
joystick2_set_cfg_register
- Functions for configuration joystickjoystick2_get_position
- Functions for get Joystick positionjoystick2_get_interrupt_state
- Functions for read interrupt state
Open Source
Code example
The complete application code and a ready-to-use project are available through the NECTO Studio Package Manager for direct installation in the NECTO Studio. The application code can also be found on the MIKROE GitHub account.
/*!
* \file
* \brief Joystick2 Click example
*
* # Description
* The demo application shows reading the joistick position ..
*
* The demo application is composed of two sections :
*
* ## Application Init
* Configuring clicks and log objects.
* Reset device and settings the click in the default configuration.
*
* ## Application Task
* It reads the position of the joystick,
* if it detects that the joystick has moved from the zero position,
* it prints a message about the current position.
*
* @note: The I2C peripheral lines external pull up can be required.
*
* \author Katarina Perendic
*
*/
// ------------------------------------------------------------------- INCLUDES
#include "board.h"
#include "log.h"
#include "joystick2.h"
// ------------------------------------------------------------------ VARIABLES
static joystick2_t joystick2;
static log_t logger;
// ------------------------------------------------------ APPLICATION FUNCTIONS
void application_init ( void )
{
log_cfg_t log_cfg;
joystick2_cfg_t cfg;
/**
* Logger initialization.
* Default baud rate: 115200
* Default log level: LOG_LEVEL_DEBUG
* @note If USB_UART_RX and USB_UART_TX
* are defined as HAL_PIN_NC, you will
* need to define them manually for log to work.
* See @b LOG_MAP_USB_UART macro definition for detailed explanation.
*/
LOG_MAP_USB_UART( log_cfg );
log_init( &logger, &log_cfg );
log_info( &logger, "---- Application Init ----" );
// Click initialization.
joystick2_cfg_setup( &cfg );
JOYSTICK2_MAP_MIKROBUS( cfg, MIKROBUS_1 );
joystick2_init( &joystick2, &cfg );
joystick2_reset( &joystick2 );
joystick2_default_cfg( &joystick2 );
log_info( &logger, "---- JOYSTICK START ----" );
}
void application_task ( void )
{
uint8_t joystick_pos;
// Task implementation.
joystick_pos = joystick2_get_position( &joystick2 );
switch ( joystick_pos )
{
case JOYSTICK2_BUTTON_ACTIVE:
{
log_info( &logger, "--- Button is pressed!!! ---" );
Delay_ms( 300 );
break;
}
case JOYSTICK2_POSITION_RIGHT:
{
log_info( &logger, "--- Joystick position [RIGHT] ---" );
Delay_ms( 300 );
break;
}
case JOYSTICK2_POSITION_LEFT:
{
log_info( &logger, "--- Joystick position [LEFT] ---" );
Delay_ms( 300 );
break;
}
case JOYSTICK2_POSITION_UP:
{
log_info( &logger, "--- Joystick position [UP] ---" );
Delay_ms( 300 );
break;
}
case JOYSTICK2_POSITION_DOWN:
{
log_info( &logger, "--- Joystick position [DOWN] ---" );
Delay_ms( 300 );
break;
}
}
}
void main ( void )
{
application_init( );
for ( ; ; )
{
application_task( );
}
}
// ------------------------------------------------------------------------ END