We strongly encourage users to use Package manager for sharing their code on Libstock website, because it boosts your efficiency and leaves the end user with no room for error. [more info]
Rating:
Author: MIKROE
Last Updated: 2019-09-25
Package Version: 1.0.0.0
mikroSDK Library: 1.0.0.0
Category: Pushbutton/Switches
Downloaded: 3053 times
Not followed.
License: MIT license
Button Alarm Click is a very interesting interactive gadget on a Click board. It is an integrated capacitive touch sensor display in the form of a button.
Do you want to subscribe in order to receive notifications regarding "Button ALARM click" changes.
Do you want to unsubscribe in order to stop receiving notifications regarding "Button ALARM click" changes.
Do you want to report abuse regarding "Button ALARM click".
Library Description
The library covers all the necessary functions to control Button ALARM Click board. The library contains a function that checks and returns the state of the alarm button - whether it is pressed or not. Using the PWM function, you can adjust the LED light of the alarm button.
Key functions:
uint8_t buttonalarm_getButtonState()
- Gets state of the alarm button function.Examples description
The application is composed of the three sections :
void applicationTask() { buttonState = buttonalarm_getButtonState(); cnt = 0; while ( ( cnt < 200 ) && ( buttonState == _BUTTONALARM_BUTTON_STATE_OFF ) ) { buttonState = buttonalarm_getButtonState(); buttonalarm_pwmSetDuty( _BUTTONALARM_DUTY_CYCLE_ON ); cnt++; Delay_ms( 1 ); } cnt = 0; while ( ( cnt < 200 ) && ( buttonState == _BUTTONALARM_BUTTON_STATE_OFF ) ) { buttonState = buttonalarm_getButtonState(); buttonalarm_pwmSetDuty( _BUTTONALARM_DUTY_CYCLE_OFF ); cnt++; Delay_ms( 1 ); } if( buttonState ) { mikrobus_logWrite(" Button is pressed ", _LOG_LINE); while ( dutyCycle < _BUTTONALARM_DUTY_CYCLE_ON ) { dutyCycle += 200; buttonalarm_pwmSetDuty( dutyCycle ); if ( dutyCycle > _BUTTONALARM_DUTY_CYCLE_ON ) { dutyCycle = _BUTTONALARM_DUTY_CYCLE_OFF; buttonalarm_pwmSetDuty( dutyCycle ); Delay_ms( 100 ); } Delay_ms( 50 ); } dutyCycle = _BUTTONALARM_DUTY_CYCLE_OFF; mikrobus_logWrite( "---------------------", _LOG_LINE ); } }
Additional Functions :
Other mikroE Libraries used in the example:
PWM
UART
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. The terminal available in all MikroElektronika compilers, or any other terminal application of your choice, can be used to read the message.