Button Y Click Board
Button Y Click Board
The Button Y Click Board™ is equipped with the tactile switch, sometimes referred to as a pushbutton. A pushbutton is a component that is used very often in various designs, allowing the user to interact with the application. Although it sounds simple, a button needs to comply with a range of application requirements. It needs to have a very good mechanical endurance while retaining its specifications, a predictable bouncing time, a very low ON resistance, very high OFF resistance, and it needs to fulfil aesthetical requirements.
It comes in a package that also includes the mikroSDK software and a library with all the functions. The Button Y Click Board™ comes as a fully tested and approved prototype, making it a reliable device ready to use on the development board.
Software Support
We provide a library for the Button Y Click Board™ on our LibStock page, as well as a demo application (example), developed using MikroElektronika compilers. The demo can run on all the main MikroElektronika development boards.
Library Description
The library contains a function that checks and returns the state of the button - whether it is pressed or not. Using the PWM function, you can adjust the LED light button.
Key Functions
uint8_t buttony_getButtonState()
- Functions for Get Button state
Example Description
The application is composed of the three sections :
- System Initialization - Sets INT pin ad INPUT
- Application Initialization - Initialization driver init and PWM init
- Application Task - (code snippet) - Check if the button is pressed. If it is, logs a message to USBUART and lights up the light on 2 clocks.
void applicationTask() { buttonState = buttony_getButtonState(); if ((buttonState == _BUTTONY_BUTTON_IS_PRESSED) && (_pressFlag == 0)) { _pressFlag = 1; } if (_pressFlag == 0) { _dutyCycle += 250; buttony_pwmSetDuty(_dutyCycle); if (_dutyCycle > 10000 ) { _dutyCycle = 0; buttony_pwmSetDuty(_dutyCycle); Delay_ms(2000); } Delay_ms( 50 ); } else { if(buttonState == _BUTTONY_BUTTON_IS_PRESSED) { mikrobus_logWrite(" Button is pressed ", _LOG_LINE); buttony_pwmSetDuty(10000); Delay_ms( 2000 ); } else { buttony_pwmSetDuty(0); } } }
The full application code, and ready to use projects can be found on our LibStock page.
Other mikroE Libraries used in the example:
PWM
Additional Notes and Information
Depending on the development board you are using, you may need a 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. The terminal available in all MikroElektronika compilers, or any other terminal application of your choice, can be used to read the message.
MIKROSDK
The Button Y Click Board™ is supported with mikroSDK - MikroElektronika 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.
Button Y Click Board
Frequently Asked Questions
Have a Question?
Be the first to ask a question about this.